Install – Configure WordPress with NGINX and HHVM

WordPress with NGINX and HHVM


HipHop Virtual Machine (HHVM) is an open-source virtual machine designed for executing programs written in Hack and PHP. It uses a just-in-time compilation to provide better performance and supports PHP 5 and major features of PHP 7. This tutorial explains how to set up and run WordPress with NGINX and HHVM on openSUSE 42.2 Leap.

Getting started

Install NGINX

NGINX is available on openSUSE repositories, so just use zypper to install it:

# zypper in nginx

Start it with systemd:

# systemctl start nginx

Check if everything is going well using the following code:

# systemctl status nginx
nginx.service - The nginx HTTP and reverse proxy server 
   Loaded: loaded (/usr/lib/systemd/system/nginx.service; disabled; vendor preset: disab
   Active: active (running) since Mon 2017-03-13 13:49:14 CET; 26s ago

Install and configure MariaDB

As for NGINX, MariaDB is available in repositories. To start:

# zypper in mariadb mariadb-client

Fire it up and verify with systemd:

# systemctl start mysql
# systemctl status mysql
 mysql.service - MySQL server 
   Loaded: loaded (/usr/lib/systemd/system/mysql.service; disabled; vendor preset: disab
   Active: active (running) since Mon 2017-03-13 13:56:27 CET; 5s ago

Configure its root account:

# mysql_secure_installation
New password:  
Re-enter new password:  
Password updated successfully! 
Reloading privilege tables.. 
 ... Success! 
Remove anonymous users? [Y/n] Y 
 ... Success! 
Disallow root login remotely? [Y/n] Y 
 ... Success! 
Remove test database and access to it? [Y/n] Y 
 - Dropping test database... 
 ... Success! 
 - Removing privileges on test database... 
 ... Success! 
Reload privilege tables now? [Y/n] Y 
 ... Success! 
Cleaning up... 
All done!  If you've completed all of the above steps, your MariaDB 
installation should now be secure. 
Thanks for using MariaDB!

Create new user and database for WordPress. Login to MariaDB shell:

# mysql -u root -p
MariaDB [(none)]> CREATE DATABASE wordpress_db; 
MariaDB [(none)]> CREATE USER wordpressusr@localhost IDENTIFIED BY 'usr_strong_password'
MariaDB [(none)]> GRANT ALL PRIVILEGES ON wordpress_db.* TO [email protected] IDENT
IFIED BY 'usr_strong_password'; 
MariaDB [(none)]> FLUSH PRIVILEGES; 
MariaDB [(none)]> EXIT; 

Now, MariaDB is correctly installed and configured, and a new database for WordPress has been created. Take note of its informations.

Install HHVM

To install HHVM, first you must add a repository:

# zypper addrepo

Then refresh repositories with:

# zypper refresh

Enter ‘a’ to trust the key:

 Repository:       munix9's Home Project (openSUSE_Leap_42.2)               
  Key Name:         home:munix9 OBS Project <home:[email protected]> 
  Key Fingerprint:  3FE0C0AC 1FD6F103 4B818A14 BDF3F6AC D4D81407             
  Key Created:      Tue Aug 16 11:47:54 2016                                 
  Key Expires:      Thu Oct 25 11:47:54 2018                                 
  Rpm Name:         gpg-pubkey-d4d81407-57b2e14a                             
Do you want to reject the key, trust temporarily, or trust always? [r/t/a/? shows all op
tions] (r): a 
Retrieving repository 'munix9's Home Project (openSUSE_Leap_42.2)' metadata ......[done] 
Building repository 'munix9's Home Project (openSUSE_Leap_42.2)' cache ...........[done]

Now, install HHVM:

# zypper in hhvm hhvm-nginx hhvm-fastcgi

Configure HHVM and NGINX

Create a user and a group named nginx:

# useradd -M -s /bin/bash -U nginx

Next, you’ll need to configure HHVM for running with NGINX as the web server. To do this, edit the following file:

# $EDITOR /etc/hhvm/server.ini

Uncommenting line 3, Unix sockets will be enabled for HHVM. After the modification, the content of the file should look like this:

; some settings already defined in hhvm.service 
;hhvm.server.port = 9000 
hhvm.server.file_socket = /run/hhvm/server.sock 
hhvm.server.type = fastcgi 
hhvm.server.default_document = index.php 
; if you use mod_rewrite or get a 404 not found please try adding: 
;hhvm.server.fix_path_info = true 
hhvm.log.use_log_file = true 
hhvm.log.file = /var/log/hhvm/server.log 
hhvm.repo.central.path = /var/lib/hhvm/hhvm.hhbc 
;hhvm.repo.central.file_mode = 420 
;hhvm.repo.central.file_user = hhvm 
;hhvm.repo.central.file_group = hhvm

Next, edit the HHVM service, and change the user in nginx:

# $EDITOR /usr/lib/systemd/system/hhvm.service

Description=HipHop Virtual Machine (FCGI) 
Before=apache2.service nginx.service 
ExecStartPre=/bin/rm -f /run/hhvm/server.sock 
ExecStart=/usr/bin/hhvm --config /etc/hhvm/php.ini --config /etc/hhvm/server.ini --user 
nginx --mode server -vServer.Type=fastcgi -vServer.FileSocket=/run/hhvm/server.sock -vPi

Save, exit, and change the owner of /var/run/hhvm:

#chown -R nginx:nginx /var/run/hhvm/

Next, configure HHVM to work with NGINX.

First, execute the following command:

# cp /etc/nginx/hhvm.conf.example /etc/nginx/hhvm.conf

Then, edit this configuration file:

# $EDITOR /etc/nginx/hhvm.conf

As follows:

location ~ \.(hh|php)$ { 
    root  /srv/www/htdocs; 
    fastcgi_keep_conn on; 
    fastcgi_pass   unix:/run/hhvm/server.sock; 
    fastcgi_index  index.php; 
    fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name; 
    include        fastcgi_params; 

Next, edit the NGINX configuration file, /etc/nginx/nginx.conf. On line 59, add:

include /etc/nginx/nginx.conf;

Save, exit, start HHVM and restart NGINX:

# systemctl start hhvm
# systemctl restart nginx


# nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok 
nginx: configuration file /etc/nginx/nginx.conf test is successful

Now test HHVM. To accomplish this task, create a new file called info.php on /srv/www/htdocs and write the following code into it:

<?php phpinfo(); ?>

Save and exit. With a web browser, go to http://localhost/info.php and it should display the following page:


Create a new Virtual Host

Now it’s time to create a new Virtual Host file for NGINX that will be stored in the folder /etc/nginx/vhosts.d/. Create it:

# mkdir -p /etc/nginx/vhosts.d/

Inside it, create a new file:

# $EDITOR /etc/nginx/vhosts.d/mysite.conf

And paste the following configuration:

server {
	# This line for redirect non-www to www
	rewrite ^(.*)$1 permanent;

server {

        listen   80;
        root /srv/www/mysite; 
        index index.php index.html index.htm;

        location / {
                try_files $uri $uri/ =404;

        error_page 500 502 503 504 /50x.html;
        location = /50x.html {
              root /srv/www/htdocs;

        # HHVM running throught Unix-Socket
	location ~ \.(hh|php)$ {
    		root   /srv/www/mysite;
    		fastcgi_keep_conn on;
    		fastcgi_pass   unix:/var/run/hhvm/server.sock;
    		fastcgi_index  index.php;
    		fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;
   		include        fastcgi_params;


Save and exit.

Create the web site root directory, specified in the Virtual Host configuration file:

# mkdir -p /srv/www/mysite

Install WordPress

Download WordPress in the site root directory:

# cd /srv/www/mysite
# wget

Next, extract the archive:

# unzip
# mv wordpress/* .

Copy the sample configuration file and edit it:

# cp wp-config-sample.php wp-config.php
# $EDITOR wp-config.php

Edit the database lines as follows:

// ** MySQL settings - You can get this info from your web host ** // 
/** The name of the database for WordPress */ 
define('DB_NAME', 'wordpress_db'); 
/** MySQL database username */ 
define('DB_USER', 'wordpressusr'); 
/** MySQL database password */ 
define('DB_PASSWORD', 'usr_strong_password'); 
/** MySQL hostname */ 
define('DB_HOST', 'localhost');

Save and exit.


Now, just visit with the following URL with a web browser: WordPress should start, giving you the chance to finish configuration, and start using WP!

  • Have you in any case obtained a whole lot of money without providing for sale anything at all or even without managing any sort of multi level marketing type of task and never have to make an investments something. I would like to discuss a project whereby all of the software will likely be provied to you and therefore it really is a relatively easy and not hard venture. Without having to launch your very own domain name and stuff like that., everything is certainly made available to you free of charge. Folks are going to look at your main site therefore you will be able to get paid for that. It really is as easy as that. I’m creating quite a bit of cash in a home office because of this work like 20 thousand bucks per month or over and if you might genuinely wish to receive same as that so therefore follow these particular so easy manuals by exploring this site >>>>> GOCHIURL.COM/15d9j

  • Abhishek Rukhaiyar

    Just use Easyengine. In 2-3 command a WordPress website is ready with nginx, hhvm, php7 fallback, redis and mariadb.

  • Мak℮ еxτra ˛ncome աorkιϖg fᴦoᴍ ү౦ᴜr հoʋse for Ƨ t໐ б հгƽ ੦n ᑯaӏ|y Ьαsis٫ anᏧ starτ mαк˛ng avеrαgiռᶃ oոe ᴛo τhг℮e τh೦ᴜsaϖᏧ Ꮟսᴄκs everʏ wе℮k۔ Reaԁ ᴍore inf૦rmaτion hеre> V15.UK/0XNra

  • Ϲhecĸ ௦ʋᴛ α great ԝауѕ τ๐ geτ рaiԁ ɑ Ɩ౦ᴛ of ᴄash bʏ աorking bаsiᴄ work oᴠer vveb ſroᴍ ყour հ૦uѕe f๐r few shoгt Ꮒoսrѕ ᜵dai|у ~ Clıϲᴋ oп tհ℮ ǀᎥnk GET.LC/yGUZX


  • I initiated freelancing over world wide web, through doing some basic tasks which primarily demanded a computer and consequently access to net and additionally Now I am satisfied than ever before… six months time get gone by since i started out this and therefore i received cash total of $36,000… Basically I make eighty usd each hour and even work for 3 to four hrs most of the days.And beauty of this is that you can organize time whenever you work and so for how long as you like but you still gain a paycheck weekly. —->>>LEARN A lot more About That here-> V15.UK/96i5Z


  • I started out freelancing over internet, through doing some fundamental work which solely required your working personal computer and consequently usage of internet and Now I am delighted than always… 6 months have passed by when i started out this and additionally i had profit total of 36 thousand dollars… Basically I earn 80 bucks each and every hour as well as work for 3 to four hours most of the times.And beauty of this is that you can manage precious time when you work and so for how long as you like but you still get a take-home pay in one week. —->>>LEARN Additional Regarding It here-> RU.VU/bzJLB