Install WordPress 4.0 with Nginx 1.6 on Linux Mint 17
WordPress is the most widely used open source web blogging and content management software written in PHP and MySQL; even ITzGeek uses WordPress. Here is the small tutorial on setting up WordPress installation with Nginx on Linux Mint 17.
Prerequisites
Before proceeding, you might want to look at the following.
1. Install EMP (Nginx, MySQL and PHP) on Linux Mint 17
2. Install phpMyAdmin with Nginx on Linux Mint 17 (Optional)
Configuring Nginx
Lets create a virtual host for WordPress installation, virtual host configuration files can be found in /etc/nginx/conf.d directory. Normally virtual host files contain domain name, port number, document root, log location, fast cgi, etc,. We have to keep that in mind before creating the file.
Assume the following,
Domain name: wordpress.itzgeek.com
Port No: 80
Document root: /usr/share/nginx/wordpress.itzgeek.com
Logs: /usr/share/nginx/wordpress.itzgeek.com/logs
Create a virtual host.
$ sudo nano /etc/nginx/conf.d/wordpress.conf
Place the following content.
server { listen 80; server_name wordpress.itzgeek.com; access_log /usr/share/nginx/wordpress.itzgeek.com/logs/access.log; error_log /usr/share/nginx/wordpress.itzgeek.com/logs/error.log; location / { root /usr/share/nginx/wordpress.itzgeek.com; index index.php index.html index.htm; if (-f $request_filename) { expires 30d; break; } if (!-e $request_filename) { rewrite ^(.+)$ /index.php?q=$1 last; } } location ~ .php$ { fastcgi_pass unix:/var/run/php5-fpm.sock; # port where FastCGI processes were spawned fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /usr/share/nginx/wordpress.itzgeek.com$fastcgi_script_name; # same path as above fastcgi_param PATH_INFO $fastcgi_script_name; include /etc/nginx/fastcgi_params; } }
Create document root and logs directory.
$ sudo mkdir /usr/share/nginx/wordpress.itzgeek.com $ sudo mkdir /usr/share/nginx/wordpress.itzgeek.com/logs
Verify the configuration files.
$ sudo nginx -t
If you get the following, it means that virtual host entries are correct.
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok nginx: configuration file /etc/nginx/nginx.conf test is successful
Restart the services.
$ sudo service nginx reload $ sudo service php5-fpm restart
Creating database:
Login into MySQL.
mysql -u root -p
Create the desired database for WordPress.
CREATE DATABASE wordpress;
Create a user.
CREATE USER 'wpuser'@'localhost' IDENTIFIED BY 'wppassword';
Grant the permission to the created user to access the database.
GRANT ALL PRIVILEGES ON wordpress.* TO 'wpuser'@'localhost';
Configuring WordPress
Download the latest WordPress.
$ wget http://wordpress.org/latest.tar.gz
Extract it.
$ tar -zxvf latest.tar.gz
Move it to our document root.
$ sudo mv wordpress/* /usr/share/nginx/wordpress.itzgeek.com
Copy the wp-sample-config.php file and make it as the wp-config.php file.
$ sudo cp /usr/share/nginx/wordpress.itzgeek.com/wp-config-sample.php /usr/share/nginx/wordpress.itzgeek.com/wp-config.php
Edit the config file and mention the database information.
$ sudo nano /usr/share/nginx/wordpress.itzgeek.com/wp-config.php
Default will look like below.
/** The name of the database for WordPress */
define(‘DB_NAME’, ‘database_name_here‘);
/** MySQL database username */
define(‘DB_USER’, ‘username_here‘);
/** MySQL database password */
define(‘DB_PASSWORD’, ‘password_here‘);
/** MySQL hostname */
define(‘DB_HOST’, ‘localhost‘);
Modified entries according to the created database user and database will look like.
/** The name of the database for WordPress */
define(‘DB_NAME’, ‘wordpress‘);
/** MySQL database username */
define(‘DB_USER’, ‘wpuser‘);
/** MySQL database password */
define(‘DB_PASSWORD’, ‘wppassword‘);
/** MySQL hostname */
define(‘DB_HOST’, ‘localhost‘);
Make the apache user as the owner to WordPress directory.
$ sudo chown -R www-data:www-data /usr/share/nginx/wordpress.itzgeek.com/
Install WordPress:
Open your browser and visit http://fqdn / OR http://wordpress.itzgeek.com, enter the site information and click on Install WordPress.

You will see the next page like below.

If you click on continue, you will be asked to enter the password to access the WordPress admin section.

The following screenshot shows you server information using System Information plugin, and it is clearly showing the Server software as Nginx 1.6.2.

That’s All!.