Skip to content

Instantly share code, notes, and snippets.

@marsyang1
Last active May 19, 2016 18:43
Show Gist options
  • Select an option

  • Save marsyang1/61bac4d3ac19c4676e84a73150f03404 to your computer and use it in GitHub Desktop.

Select an option

Save marsyang1/61bac4d3ac19c4676e84a73150f03404 to your computer and use it in GitHub Desktop.
ubuntu-install-wordpress.sh
# reference : https://www.digitalocean.com/community/tutorials/how-to-install-wordpress-with-nginx-on-ubuntu-14-04
cd ~ && apt-get update -y && apt-get install -y wget lsb-release nginx php-fpm rsync vim \
&& debconf-set-selections <<< 'mysql-server mysql-server/root_password password 1234' \
&& debconf-set-selections <<< 'mysql-server mysql-server/root_password_again password 1234' \
&& echo "[client]
user=root
password=1234
host=localhost" > ~/.my.cnf \
&& apt-get update && apt-get install -y mysql-server && service mysql start \
&& echo "create database wordpress" | mysql -u root \
&& wget http://wordpress.org/latest.tar.gz && tar xzvf latest.tar.gz && cd wordpress && cp wp-config-sample.php wp-config.php \
&& sed -i 's/database_name_here/wordpress/g' wp-config.php \
&& sed -i 's/username_here/root/g' wp-config.php && sed -i 's/password_here/1234/g' wp-config.php \
&& mkdir -p /var/www/html && rsync -avP ~/wordpress/ /var/www/html/ && chown -R root:www-data /var/www/html/* \
&& mkdir /var/www/html/wp-content/uploads && chown -R :www-data /var/www/html/wp-content/uploads \
&& cp /etc/nginx/sites-available/default /etc/nginx/sites-available/wordpress \
&& sed -i 's/index.html/index.php/g' /etc/nginx/sites-available/wordpress \
&& sed -i 's/server_name _/server_name wordpress/g' /etc/nginx/sites-available/wordpress \
&& sed -i 's/=404/\/index.php?q=$uri\&$args/g' /etc/nginx/sites-available/wordpress \
&& ln -s /etc/nginx/sites-available/wordpress /etc/nginx/sites-enabled/ \
&& rm /etc/nginx/sites-enabled/default && service nginx restart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment