We'll be using the default blog directory of /usr/share/nginx/html, so if you have a different one like /var/www/html please use it instead.
The first step is to get the WordPress system from wordpress.org
in a terminal type:
cd /tmpthen we unpack the archive
wget http://wordpress.org/latest.tar.gz
tar -zxvf latest.tar.gzand move to our blog directory
mv wordpress/ /usr/share/nginx/html/next, we change the group and owner of this directory to www-data, which is needed by our web-server to have access to the files:
chown -R www-data:www-data /usr/share/nginx/html/wordpressthen give permissions for all users in this owner to read, write and execute(7) files in the blog directory, and for the group and other users just to be able to read and execute files(5):
chmod -R 755 /usr/share/nginx/html/wordpresswe set the same rules to be automatically applied for any sub-directory to be created within /wordpress/, to serve image or other uploads, plugins etc.
sudo chmod g+s /usr/share/nginx/html/wordpressThen we launch mysql client
mysql -u rootand lets create the default wordpress database:
CREATE DATABASE wordpress;create one user wp_user in order to have access to our wordpress database:
CREATE USER wp_user IDENTIFIED BY 'wp_pass';
and give permissions to wp_user to be able to create tables, insert data etc. inside the wordpress database:
GRANT ALL PRIVILEGES ON wordpress.* TO wp_user;now is time to set up the default configuration of our blog to use this database so we go to our blog directory, rename and use the default config file:
mv wp-config-sample.php wp-config.phpthen open it up for editing via:
sudo nano wp-config.phpjust change these three to ensure that WordPress will have access to MySQL:
define('DB_NAME', 'wordpress');set database user name:
define('DB_USER', 'wp_user');set database password
define('DB_PASSWORD', 'wp_pass');finally, open up a browser and type:
http://localhost/wordpress/index.php
then follow the steps and your WordPress installation is ready!