DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
  1. DZone
  2. Software Design and Architecture
  3. Cloud Architecture
  4. How to Setup Wordpress with NGINX and HHVM on Ubuntu 16.04

How to Setup Wordpress with NGINX and HHVM on Ubuntu 16.04

Explore Facebook's open source virtual machine by following this guide to install HHVM, Wordpress, and NGINX using Ubuntu.

Hitesh Jethva user avatar by
Hitesh Jethva
·
Sep. 10, 18 · Tutorial
Like (2)
Save
Tweet
Share
3.08K Views

Join the DZone community and get the full member experience.

Join For Free

Introduction

HHVM, also known as HipHop Virtual Machine, is an open source virtual machine developed by Facebook that can be used for executing programs written in Hack and PHP. HHVM uses a just-in-time compilation approach for performance reasons. HHVM is faster than the traditional PHP engine from ZEND and is used by Facebook to serve billions of web requests per day.

In this tutorial, we will be going to explain how to install WordPress with NGINX, MariaDB, and HHVM on Ubuntu 16.04 Server.

Requirements

  • A fresh Alibaba Cloud instance with Ubuntu 16.04 server installed.
  • A static IP address 192.168.0.103 is configured on the instance.
  • A Root password is setup on the server.

Launch Alibaba Cloud ECS Instance

First, Login to your  Alibaba Cloud ECS Console. Create a new ECS instance, choosing Ubuntu 16.04 as the operating system with at least 2GB RAM. Connect to your ECS instance and log in as the root user.

Once you are logged into your Ubuntu 16.04 instance, run the following command to update your base system with the latest available packages.

apt-get update -y

Install NGINX and MariaDB

First, you will need to install NGINX web server and MariaDB to your server. You can install them using the following command:

apt-get install nginx mariadb-server mariadb-client -y

Once both are installed, start NGINX and MariaDB service and enable them to start on boot time using the following command:

systemctl start nginx
systemctl enable nginx
systemctl start mariadb
systemctl enable mariadb

Configure MariaDB

By default, MariaDB installation is not secured, so you will need to secure it first. You can secure it by running the mysql_secure_installation script:

mysql_secure_installation


Answer all the questions as shown below:

Enter current password for root (enter for none): PRESS ENTER
Set root password? [Y/n] n
Remove anonymous users? [Y/n] Y
Disallow root login remotely? [Y/n] Y
Remove test database and access to it? [Y/n] Y
Reload privilege tables now? [Y/n] Y


Once MariaDB is secured, log in to MariaDB shell using the following command:

mysql -u root -p


Enter your root password when prompt, then create a database for Wordpress:

MariaDB [(none)]> create database wordpressdb;


Next, grant all privileges on wordpressdb using the following command:

MariaDB [(none)]> grant all privileges on wordpressdb.* to wordpress@localhost identified by 'password';


Next, flush the privileges with the following command:

MariaDB [(none)]> flush privileges;


Finally, exit from the MariaDB shell with the following command:

MariaDB [(none)]> exit;

Install and Configure HHVM

By default, HHVM is not available in Ubuntu 16.04 default repository. So you will need to add HHVM repository to your system. You can do this by running the following command:

apt-get install software-properties-common
apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0x5a16e7281be7a449
add-apt-repository "deb http://dl.hhvm.com/ubuntu $(lsb_release -sc) main"


Next, update the HHVM repository and install HHVM using the following command:

apt-get update -y
apt-get install hhvm -y


Once HHVM is installed, you should see the following output:

********************************************************************
* HHVM is installed.
*
* The best way to get started is to use HHVM's built-in webserver:
*
* $ hhvm -m server -p 8080
*
* Running command-line scripts with HHVM requires no special setup:
*
* $ hhvm whatever.php
*
* FastCGI is also supported; see https://docs.hhvm.com/hhvm/advanced-usage/fastCGI
*
********************************************************************


Next, you will need to configure NGINX web server to use HHVM. You can do this with the following command:

/usr/share/hhvm/install_fastcgi.sh


You should see the following output:

[ ok ] Starting hhvm (via systemctl): hhvm.service.
Checking if Apache is installed
WARNING: Couldn't find Apache2 configuration paths, not configuring
Checking if Nginx is installed
Detected Nginx installation
Checking for custom Nginx configuration
Enabling hhvm Nginx module
Finished enabling module
Restarting Nginx


Next, start HHVM automatically on system startup using the following command:

update-rc.d hhvm defaults


Next, run the following command to use HHVM as a PHP alternative:

/usr/bin/update-alternatives --install /usr/bin/php php /usr/bin/hhvm 60


Finally, start HHVM service using the following command:

systemctl start hhvm


You can check the status of HHVM using the following command:

systemctl status hhvm


Output:

● hhvm.service - LSB: Starts The HHVM FastCGI Daemon
   Loaded: loaded (/etc/init.d/hhvm; bad; vendor preset: enabled)
   Active: active (running) since Wed 2018-05-16 21:13:19 IST; 1min 14s ago
     Docs: man:systemd-sysv-generator(8)
   CGroup: /system.slice/hhvm.service
           ├─3365 /usr/bin/hhvm --config /etc/hhvm/php.ini --config /etc/hhvm/server.ini --user www-data --mode daemon -vPidFile=/var/run/hhvm/
           ├─3389 /usr/bin/hhvm --config /etc/hhvm/php.ini --config /etc/hhvm/server.ini --user www-data --mode daemon -vPidFile=/var/run/hhvm/
           ├─3390 sh -c /usr/bin/hh_single_compile -v Hack.Compiler. --daemon
           └─3392 /usr/bin/hh_single_compile -v Hack.Compiler. --daemon
May 16 21:13:18 Node1 systemd[1]: Starting LSB: Starts The HHVM FastCGI Daemon...
May 16 21:13:19 Node1 systemd[1]: Started LSB: Starts The HHVM FastCGI Daemon.
May 16 21:14:29 Node1 systemd[1]: Started LSB: Starts The HHVM FastCGI Daemon.


Now, verify the PHP version with the following command:

php -v


Output:

HipHop VM 3.26.2 (rel)
Compiler: 1526415369_337251688
Repo schema: 7960f749dc8fba766d4ac967f6693b0ff0f1430b

Install Wordpress

First, you will need to download the latest version of the Wordpress from their official website. You can do this with the following command:

wget https://wordpress.org/latest.zip


Once the download is completed, unzip the downloaded file with the following command:

unzip latest.zip


Next. copy the extracted directory to the NGINX web root directory using the following command:

cp -r wordpress/* /var/www/html/


Next, change the directory to the "/var/www/html/" and copy WordPress sample config file:

cd /var/www/html/
cp wp-config-sample.php wp-config.php


Next, open wp-config.php file and add database credentials which you have created earlier:

nano wp-config.php


Make the following changes:

/** The name of the database for WordPress */
define('DB_NAME', 'wordpressdb');
/** MySQL database username */
define('DB_USER', 'wordpress');
/** MySQL database password */
define('DB_PASSWORD', 'password');
/** MySQL hostname */
define('DB_HOST', 'localhost');


Save and close the file, then give proper permissions to the wordpress:

chown -R www-data:www-data /var/www/html/
chmod -R 775 /var/www/html/


Finally, restart the NGINX and HHVM services.

systemctl restart nginx
systemctl restart hhvm


Access Wordpress Web Installation Wizard

Now, open your web browser and type the URL "http://your-server-ip/index.php," and you will be redirected to the following page:

Image title

Here, choose the English language and click on the "Continue" button, you should see the following page:

Image title

Here, provide your Sitename, admin username and email address, then click on the "Install Wordpress" button. Once Wordpress is installed, you should see the following page:

Image title

Now, click on the "Log In" button, you will be redirected to the Wordpress login page:

Image title

Now, provide your login credential and click on the "Log In" button, you should see the Wordpress dashboard in the following image:

Image title


WordPress ubuntu Command (computing) operating system MariaDB Alibaba Cloud

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • Why You Should Automate Code Reviews
  • 2023 Software Testing Trends: A Look Ahead at the Industry's Future
  • Kubernetes vs Docker: Differences Explained
  • Why Open Source Is Much More Than Just a Free Tier

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends: