Guide to Setup Virtualmin with NGINX and PHP-FPM

Posted on July 03, 2013

1. Install Webmin

create the /etc/yum.repos.d/webmin.repo file containing

name=Webmin Distribution Neutral

fetch and install my GPG key with which the packages are signed, with the commands:

rpm --import jcameron-key.asc

Install webmin with command:

yum install webmin

2. Install Virtualmin

Create IP with hostname by adding the following line to /etc/hosts:

x.x.x.x server1

Verify hostname:

hostname --fqdn

Install virtualmin:


3. Remove Apache and install Nginx

Shut down Apache with the command

/etc/init.d/httpd stop ; service httpd off (on RHEL or CentOS),
yum install nginx (on RHEL or CentOS)
/etc/init.d/nginx start
yum install wbm-virtualmin-nginx wbm-virtualmin-nginx-ssl (on RHEL or CentOS)

4. Configure Virtualmin to use NGINX

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

5. Using NginX

  • Once Nginx support has been configured, you should be able to create virtual servers just as you would with Apache. However, on the Create Virtual Server page you will need to select Enable Nginx website? in theEnabled features section, instead of Enable Apache.
  • When creating a domain from the command-line API, you will need to use the

    flag instead of


    . For SSL websites, you will need to use –virtualmin-nginx-ssl instead of –ssl .

  • Similarly, when creating a domain via the remote API, you will need to use the

    Parameter instead of


6. Install PHP-FPM

Install RHEL EPEL repository:

sudo rpm -Uvh remi-release-6*.rpm epel-release-6*.rpm

Install spawn-fcgi if needed

yum --enablerepo=remi install php-cli spawn-fcgi

Configure spawn-fcgi

cd /opt
wget -O
mv /usr/bin/php-fastcgi
chmod +x /usr/bin/php-fastcgi
wget -O
mv /etc/rc.d/init.d/php-fastcgi
chmod +x /etc/rc.d/init.d/php-fastcgi
# chkconfig --add php-fastcgi
# chkconfig php-fastcgi on
# /etc/init.d/php-fastcgi start

Install php-fpm:

cd /etc/yum.repos.d
yum --enablerepo=remi install php-fpm
service php-fpm start
chkconfig --add php-fpm


Leave a Reply

Your email address will not be published.

Contact Us

Have a question? Send us a message. We'll get back to you soon.