Install WordPress on Nginx

This article will run through the steps involved in setting up a WordPress site. WordPress, if you’ve been living on one of the moons of Jupiter for the past five years, is an excellent framework that has the power to run everything from a personal blog to a small business site. Normally, I prefer to build from scratch but WordPress is an excellent lightweight option for deploying a blog in ten minutes or so.

This guide assumes you have a working Nginx server with PHP and a working Database.

Download latest WordPress

<a href="https://wordpress.org/download" target="_blank">https://wordpress.org/download</a>

SFTP to your server as www-data (guide here.) Create a directory for your new site. This site will be stored in

/var/www/html/jonathanneilly

Screen Shot 2015-07-14 at 22.41.25

Copy the contents of the WordPress download directory to the server directory you just created

Screen Shot 2015-07-14 at 22.41.49

Log in through SSH and elevate to su (passwords will not show as you type)

ssh user@serveraddress
su

Recursively give owner read, write and execute permissions and group + other read and execute permissions

chmod -R 755 /var/www/html/jonathanneilly

Check permissions took effect

ls -l /var/www/html/jonathanneilly

Create and edit a config file for Nginx

nano /etc/nginx/sites-available/jonathanneilly

Change the file to the following code

server {
listen 80;

root /var/www/html/jonathanneilly;

index index.php;

server_name jonathanneilly.co.uk;

location / {
try_files $uri $uri/ /index.php?$args;
}

location ~ .php$ {
include snippets/fastcgi-php.conf;

# With php5-fpm:
fastcgi_pass unix:/var/run/php5-fpm.sock;
}
}

Create a symbolic link to enabled sites

ln -s /etc/nginx/sites-available/jonathanneilly /etc/nginx/sites-enabled/

Restart Nginx

service nginx restart

Navigate to your URL and follow the install steps

Screen Shot 2015-07-14 at 22.45.02

Create a database for your site and enter the details here

Screen Shot 2015-07-14 at 22.45.56

Follow the final steps then navigate to your URL

Screen Shot 2015-07-14 at 22.46.21

You’re done! Check out some of the great free plugins and themes and you’ll have your site up in no time!

Leave a Reply

Your email address will not be published. Required fields are marked *