Recommended VPS Complete list of best VPS hosting providers.

How to Install WordPress on Nginx + HHVM VPS

Just a short tutorial with pictures about how to install a WordPress on Ubuntu VPS running Nginx, HHVM and MySQL. Using HHVM replacing PHP is somehow believed can server website faster and it is very lightweight for server’s resources. While not many PHP scripts are made compatible, WordPress is claimed compatible with HHVM (since version 3.9). So if you want to build fast-loading a WordPress blog using bleeding edge technology, try running it with HHVM.

Building HHVM + Nginx Server

Step 1 – Follow all steps in my previous tutorial and make sure you have installed it correctly.

Read:
How to Install Nginx, HHVM and MySQL on Ubuntu 15.04

Step 2 – Create new web directory for you WordPress blog. In this example I use my a sub-domain (coz I have no spare idle domain), feel free to replace it with your own.

mkdir -p /var/www/example.org
chmod -R 755 /var/www/example.org
chown -R www-data:www-data /var/www/example.org

Replace example.org with your own domain / subdomain name, in my case it looks like this:

create-new-hosts-file

Step 3 – Now let’s create new virtual hosts file for your upcoming WordPress site:

nano /etc/nginx/sites-available/example.org.conf

then copy paste this configuration:

server {
  listen 80;
    server_name example.org;
    include hhvm.conf;
 
    access_log   /var/log/nginx/access.log;
    error_log    /var/log/nginx/error.log;
 
    root /var/www/example.org;
    index index.php;
 
    location / {
        try_files $uri $uri/ /index.php?$args; 
    }
}

In my case it looks like this:

test-servermom-nginx

Now save changes and exit the editor (in Nano it is Control+O to save then Control+X to exit).

Step 4 – Now we need to create symbolic link to the new virtual hosts file so it can be enabled:

ln -s /etc/nginx/sites-available/example.org.conf /etc/nginx/sites-enabled/example.org.conf

Next, restart Nginx:

service nginx restart
service hhvm restart

pic:

symbolic-link-nginx

Install WordPress

Step 1 – Obviously we have to firstly download WordPress to our vps:

wget http://wordpress.org/latest.tar.gz

download-wordpress

Step 2 – Now copy latest.tar.gz file to your web directory and extract the main WordPress files inside that package while also removing the wordpress directory using this command:

cp latest.tar.gz /var/www/example.org
cd /var/www/example.org
tar -xzvf latest.tar.gz --strip-components=1

Step 3 – Login to MySQL as root then create new user, password and database name:

mysql -u root -p

then issue these command lines replacing “wordpress”, “dbuser” and “pass123456” with your own:

CREATE DATABASE wordpress;
CREATE USER dbuser@localhost;
GRANT ALL PRIVILEGES ON wordpress.* to dbuser@localhost IDENTIFIED BY 'pass123456';
FLUSH PRIVILEGES;
quit

screenshot:

mysql-create-new-db

Step 4 – Rename wp-config-sample.php file to wp-config.php then edit it using your favorite editor like Nano:

mv wp-config-sample.php wp-config.php
nano wp-config.php

then provide new MySQL credentials you’ve just created, here’s the example of mine:

wp-config-edit

Step 5 – Open up your favorite web browser and navigate to your domain which in my case is test.servermom.org and proceed with the installation procedure:

install-wordpress-in-browser

Hit the continue button then fill in all required fields:

install-wordpress-in-browser2

That’s it. You can now login to WordPress Dashboard.

install-wordpress-in-browser3

Enjoy your newly built WordPress site. Do not forget to follow me on Twitter or subscribe to my newsletter (via FeedBurner) so you’ll get noticed about new articles faster.

3 Comments

Add a Comment

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

Get more stuff like this
in your inbox

Subscribe and get interesting stuff plus faster updates to your email.