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

[Webmin]
name=Webmin Distribution Neutral
#baseurl=http://download.webmin.com/download/yum
mirrorlist=http://download.webmin.com/download/yum/mirrorlist
enabled=1

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

wget http://www.webmin.com/jcameron-key.asc
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.example.com server1

Verify hostname:

hostname --fqdn

Install virtualmin:

wget http://software.virtualmin.com/gpl/scripts/install.sh
/bin/sh install.sh

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
    --virtualmin-nginx

    flag instead of

    --ssl

    . 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
    virtualmin-nginx=

    Parameter instead of

    web=

6. Install PHP-FPM

Install RHEL EPEL repository:

wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
wget http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
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 php-fastcgi-rpm.sh http://library.linode.com/assets/696-php-fastcgi-rpm.sh
mv php-fastcgi-rpm.sh /usr/bin/php-fastcgi
chmod +x /usr/bin/php-fastcgi
wget -O php-fastcgi-init-rpm.sh http://library.linode.com/assets/697-php-fastcgi-init-rpm.sh
mv php-fastcgi-init-rpm.sh /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
wget http://rpms.famillecollet.com/enterprise/remi.repo
yum --enablerepo=remi install php-fpm
service php-fpm start
chkconfig --add php-fpm

6 Comments

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.

captcha

Share
Tweet
Pin
Share