WordPress Hosting – Install PHP7, Nginx and Virtualmin on CentOS 7.2

install php7 wordpress and nginx

PHP 7 is out for an while and it brings a lot of new features and performance increase for runnign sites. I have a couple of droplets on DigitalOcean but they are on CentOS 6 and PHP 5.5, as the server has not been updated for a long time I want to create a new DigitalOcean droplet install the CentOS 7.2 with PHP 7 and Virtualmin to move the sites slowly there and see how the performance is working.

In this first article I will install PHP7 and Virtualmin and make the necessary configurations to the server.

1.Create the DigitalOcean Droplet with choosing the CentOS 7 and the data center is.

dig 1

gidiag 2


2. Login to the server with SSH perform the update and install the Virtualmin with PHP7

To be able to access the server with SSH you will need to download an SSH client like putty use the password from the email sent by digitalocen and login to the server. Once loged in just follow the below steps:

  • Upgrade centOS

  • Upgrade the repo to get php7

  • Get Virtualmin and install it

  • Now the Virtual min is installed but is using the php5, next we will need to deinstall php5 and install php7

  • Check the php version:

Now you can access the Virtualmin with https://<IP>:10000 and the GUI should be displayed.


3. Installing and configurating NGINX 1.9.11 or the last version

By default Virtualmin is comming with Apatch installed which is more slow then nginx. In this part you will see how to install and configure NGINX with PHPCGI to have an fast site.

  • Stop httpd

  • Use the last NGINX repo and install it

  • So virtualmin to work with NGINX install the below:

4. Configure Virtualmin

  1. Login to Virtualmin as root, and go to Webmin -> Servers -> Nginx Webserver and make sure that Nginx and its configuration files are found.
  2. If not, click on the Module Config link and set the config and command paths correctly.
  3. Return to Virtualmin, and go to System Settings -> Features and Plugins.
  4. Un-check the “Apache website” , “SSL website” and “DAV Login”, “Mailman”, “Protected web directories”, “AWstats reporting” and “Subversion repositories” features.
  5. Check the “Nginx website” and “Nginx SSL website” features, then click “Save”.
  6. If Virtualmin reports that any other features cannot be used without Apache, go back and de-select them too.
  7. Go to the System Information page and click Refresh system information in the top right.
  8. Verify that Nginx is shown as running in the “Status” section.

5. Some Nginx  performance tweaks for WordPress

I am not realy and expert but I am using the below configurations for my NGINX server to host multiple WordPress sites and I never had an problem also the speed is very good.  You can use them also on your server, just follow the below points.

  • Open with editor the /etc/nginx/nginx.conf

  • my nginx.conf is as below you can modify it to be the same

  • Addidionaly I have created an drconf dir under /etc/nginx/ and added 2 files:

  • Below are the details you can use them

  • Restart Nginx

  • When an website is added you will need to add the below :

Here is an complete example:

This are all the configurations needed to have an CentOS 7.2 VPS server running with PHP7 /NGINX and Virtualmin/Webmin. I have it running for coupe off days and the results are very good. The site is loading very fast even without an CDN, here are some results:

WPDOZE with content and a lot off plugines installed:


    1. Liew CheonFong March 25, 2016
      • admin March 25, 2016
        • Baka97 June 23, 2016
          • admin June 23, 2016
    2. Oliver March 31, 2016
    3. Madu August 17, 2016
      • admin August 17, 2016
    4. Ahmed Rifshaan March 5, 2017
      • admin March 6, 2017

    Add Your Comment