Nginx-Only Hosting

On Plesk for Linux, you can host websites using a combination of nginx and PHP-FPM. In this case, requests to websites are not passed to Apache but are served by nginx instead. Nginx-only hosting is a solid option for PHP websites, but it is also well-suited for hosting static websites and application servers. You can configure individual websites to be served only by nginx without stopping or disabling Apache, and it does not impact websites hosted using Apache in any way.

Note: Plesk services (for example, Webmail) continue working using Apache and are not affected by switching to nginx-only hosting.

To switch on/off nginx only hosting for a domain:

  1. Go to Websites & Domains > Apache & nginx Settings.
  2. In the nginx settings section, clear the Proxy mode checkbox.
  3. Click Apply.

To revert a domain to Apache+nginx hosting, select the Proxy mode checkbox.

Known limitations

When you switch a domain to nginx-only hosting, you face certain limitations:

  • File Sharing becomes unavailable.
  • SSI, Perl, and Python support become unavailable.
  • You can only use the "FPM application server by nginx" PHP handler.
 
Configuring Static Files Processing

By default, on Plesk for Linux servers, nginx and Apache work in tandem, with Apache serving dynamic content and nginx being used as a proxy serving static content. This scheme optimizes the usage of server resources and allows Plesk to serve requests to hosted websites faster. However, Plesk allows you to choose how static content for your websites is to be handled.

Serve all static content via nginx

This is the default way Plesk for Linux operates. Whenever a request for static content comes in, Apache only indicates the corresponding file's location, and nginx finds and serves it.

To serve all static content via nginx:

  1. Go to Websites & Domains > Apache & nginx Settings and scroll down to the "nginx settings" section.
  2. Select the Proxy mode and Smart static files processing checkboxes.
  3. Make sure that the Serve static files directly by nginx checkbox is not selected.
  4. Click OK.
Serve only files with specific extensions via nginx

If you want, you can have only files with specific extensions to be served as static content by nginx. Other files usually classified as static content are served by Apache. It is important to note that under this scenario, requests for files with the specified extensions never reach Apache at all. Consequently, they do not pass through Apache handlers. This means, for example, that rewrite rules or .htaccess directives are not applied.

To serve only specific static content via nginx:

  1. Go to Websites & Domains > Apache & nginx Settings and scroll down to the "nginx settings" section.
  2. Select the Proxy mode and Serve static files directly by nginx checkboxes.
  3. By default, certain static files extensions are already preconfigured in the Serve static files directly by nginx box. You can add or remove the extensions as necessary. Separate individual file extensions using whitespaces or the "|" character.
  4. Click OK.

Note: Enabling the “Serve static files directly by nginx” option automatically disables the default “Smart static files processing” mode, even if the checkbox of the latter remains selected.

Serve all static and dynamic content via Apache

If you want, you can disable nginx and configure Apache to serve all content, both static and dynamic. It can be useful in specific cases, for example, nginx troubleshooting. For production websites, we do not recommend using Apache to handle all content.

To serve all static and dynamic content via Apache:

  1. Go to Websites & Domains > Apache & nginx Settings and scroll down to the "nginx settings" section.
  2. Select the Proxy mode checkbox.
  3. Clear the Smart static files processing and Serve static files directly by nginx checkboxes.
  4. Click OK.
 
The Default Value of Server Settings

You can set the value of each parameter either by typing a custom value, or leaving the Default value. In the latter case, Plesk uses the values from the default web server configuration defined by the server administrator (hosting provider).

Your values override the default ones. The only exception is the Deny access to the site setting - IP addresses from the default configuration, as well as the IP addresses specified by you, will all be applied to your website. In case of a conflict (for example, when you allow the IP address that is denied in the default configuration), Apache uses your settings.

 

Leave your feedback on this topic here

If you have questions or need support, please visit the Plesk forum or contact your hosting provider.
The comments below are for feedback on the documentation only. No timely answers or help will be provided.