It all began with:
1. nginx, php, virtual hosts, raspbian jessie, minimal
In this part I installed nginx and php module. I configured my router or windows machine so the DNS name 'wp.nginx' sends as forward to an IP address. I love this mechanism so much :)
2. Create MySQL database, non-root user, permissions
It is nice practice to run 'wpdb' database with different user than root. I call this use 'wpuser' and assign for it its own password. Also I need to let MySQL database engine from what location I can run MySQL queries and so. here comes 'localhost' in place.
And now the final block to install Wordpress
#!/bin/bash
#this is tested on fresh 2016-09-23-raspbian-jessie-lite.img
#sudo su
#apt-get update -y && apt-get upgrade -y && apt-get install git -y
#git clone https://github.com/catonrug/wordpress-install-raspbian-jessie-mysql-nginx-virtual-hosts.git && cd wordpress-install-raspbian-jessie-mysql-nginx-virtual-hosts && chmod +x *.sh
#nginx and php5-fpm must be installed, virtual hosts must be configured see more at 1-nginx-php-install.sh
#MySQL database 'wpdb', MySQL user 'wpuser' with password 'HAL3jpz4v7xzvGLZ' must exist. see more at 2-mysql-install-wordpress-database.sh
#./3-wordpress-install-nginx-mysql.sh
#move to virtual host directory
cd /var/www/wp.nginx
#remove everything
rm -rf *
#download latest WordPress
wget https://wordpress.org/latest.tar.gz
#extract and remove the archive
tar xzvf latest.tar.gz && rm latest.tar.gz
#move to wordpress directory
cd wordpress
#move all content to the parent directory
mv * ..
#move back
cd ..
#remove WordPress dir
rm -rf wordpress
#install adition libraries for wordpress
apt-get install php5-curl php5-gd libssh2-php -y
#to improve php5-fpm performance install cacher
apt-get install php-apc -y
#nginx service is runned by www-data user
#lets allow Nginx service to really change the content in WordPress dir
#this will allow us to do the default WordPress wizard using the web interface
chown -R www-data:www-data /var/www/wp.nginx
#restart config file for php and nginx
/etc/init.d/php5-fpm reload && /etc/init.d/nginx reload
#everything done
#i can go to wp.nginx and folow the wizard
#at first it looks nginx is slower than apache, but after restart it server good
When I configure through web interface I use credentials:
https://github.com/catonrug/wordpress-install-raspbian-jessie-mysql-nginx-virtual-hosts
No comments:
Post a Comment