In this blog article we are discussing about How to Install Virtualmin with Nginx and PHP-FPM. But the installation of  Nginx on Virtualmin server is described in below blog post. Refer it before proceeding with this blog post.

If your Virtualmin server is already enabled with Nginx, then  follow below steps to having phpfpm nginx in virtualmin.

PHP-FPM (FastCGI Process Manager) is an another type of php handler which is commonly can be seen if the web server is Nginx. Some of them preferred the same to improve their website performance.

Install php-fpm is pretty straight forward. Use yum.



Copy to Clipboard

Now Configure NGINX to use TCP connections instead of Unix sockets.

  • Log in to the webmin panel using https:IPADDRESS:10000  and go to
  • Webmin > Server > Ngnix Webserver > Module Config
  • Change Connect Nginx to PHP processes with from Socket files to TCP connections

By default at the time of website creation through virtualmin it execute PHP as php-cgi. We need to change to php-fpm. For the same we need to Disable the PHP-CGI call when creating and/or running a site:

  • Open file named /usr/libexec/webmin/virtualmin-nginx/virtualmin-nginx-lib.pl and commend line
Copy to Clipboard

  • Change the user as nginx in the file /etc/php-fpm.d/www.conf. Because in my case the nginx is running as user nginx.

  • Don’t try to start the php-fpm service as this is recommended by the virtualmin website itself.
  • Now create a website through virtualmin and after that start the php-fpm service using below command
Copy to Clipboard

  • Test it out if the php-fpm enabled or not using phpinfo page.
  • So basically what I understood is every time we create a new website on virtualmin we need to stop the php-fpm service and start again after creating the virtualmin. This is the limitation at this moment.

Now lets try PHP-FPM from an Unix Socket instead of a TCP connection. In order to do the same change the configurations we made earlier.

  • Go to Webmin > Server > Ngnix Webserver > Module Config
  • Change Connect Nginx to PHP processes with from TCP connections to Socket files
  • Add a folder for sockets using below command.
Copy to Clipboard

Open /etc/php-fpm.d/www.conf and change

Copy to Clipboard

  • Now go to Webmin > Server > Ngnix Webserver > Edit Configuration Files and change

fastcgi_pass localhost:9000; to fastcgi_pass unix:/var/run/php-fpm/DOMAINNAME.socket;

That’s all, Now we completed the setup of Nginx, php-fpm and Webmin integration. Leave your thoughts at the comment box.

Share This Story, Choose Your Platform!