Using Nginx with Virtualmin

Introduction to Nginx

Nginx is a lightweight webserver that supports most of the functionality of Apache, but is faster and uses less memory. It is suited to websites that have a large amount of static content, or virtual machines with limited memory. For more information, see https://wiki.nginx.org/Main

Installing Nginx Support

Nginx can be setup during the Virtualmin installation, but passing in the '--bundle LEMP' option to the 'install.sh' script. For more information, see the LAMP vs LAMP section of the Virtualmin Installation instructions.

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 the Enabled 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 --web . 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= .

Limitations of Nginx

Nginx as configured by Virtualmin lacks some features of Apache, such as :

  • Nginx does not support CGI, so any applications or Virtualmin scripts that use CGI will not work. Virtualmin should prevent the installation of scripts that require CGI, mod_perl or Apache-specific features.

  • PHP can only be executed via FastCGI, and all PHP scripts run with domain owner permissions. Execution via CGI or mod_php is not supported. For PHP to work, Virtualmin will setup a PHP FastCGI server process that Nginx communicates with for each virtual server.

  • Only one PHP version is supported, and Virtualmin will pick the highest version available on the system. This typically means that PHP v4 scripts cannot be run.