This article describes the use of nginx as a reverse proxy server to improve hosting performance. nginx offers advantages such as support for HTTP/2, standard gzip compression, improved performance, and high compatibility. The web server is more efficient than Apache in handling many simultaneous connections and has lower memory usage per client connection. In Plesk, nginx can be configured as a proxy for Apache or as a standalone server with PHP-FPM. When proxy mode is disabled, there are limitations such as no support for SSI, Perl, and Python, and .htaccess files are not considered.
Overview
Settings
Proxy Mode Enabled (Default)
Proxy Mode Disabled (Pure nginx Hosting)
Overview
To improve our hosting performance, nginx is used as a reverse proxy server.
By adding nginx as a reverse proxy server, the following benefits arise for you as a customer:
- Support for HTTP/2
- gzip compression enabled by default
- Improved performance
- High compatibility
The nginx web server is specifically designed to serve static content (e.g., images, video, CSS, XML, etc.) on a large scale. Unlike Apache, nginx is far more efficient at handling a large number of simultaneous connections. Another advantage of this web server over Apache is that nginx uses significantly less memory per client connection.
To optimally utilize the advantages of nginx, Plesk configures it as a reverse proxy server positioned between the internet and Apache (see the diagram below). This means that nginx becomes a front-end web server that handles all incoming requests from website visitors.
Settings
Log in to the Plesk administration tool. (Forgot your password?)
Make sure you are on the Websites & Domains tab.
Open the advanced options by clicking “Show More” if necessary.
Then click on 'Apache & nginx Settings'
Settings for nginx
These settings specify how the processing of web requests is divided between the Apache and nginx web servers to achieve better performance for a specific website. Caching is handled separately at https://support.metanet.ch/855
Using the following options, you can specify how requests should be processed by Apache and nginx:
Proxy Mode Enabled (Default)
By default, proxy mode is enabled. This means that nginx acts as a proxy server for Apache. The options below can only be selected if Proxy Mode is enabled. This allows you to specify how the request processing is divided between nginx and Apache.
Intelligent processing of static files
Disabling this option restricts the role of nginx. nginx will forward requests and responses without changes. We recommend keeping this option enabled unless you are troubleshooting an issue with nginx.
Serve static files directly via nginx
For websites with large static content (e.g., image or video files) and high traffic, better performance can be achieved by delegating the serving of static files to nginx. In this case, Apache does not handle requests for files with the specified extensions.
For example, to exclude Apache from serving jpg and gif files, enable the option Serve static files directly via nginx and specify the file extensions approximately as follows:
gif jpg
or
gif|jpg
| Note: If you enable this option, requests for static files will not be forwarded to Apache and Apache handlers will not be triggered. This means that, for example, rewrite rules or .htaccess directives will not be applied. |
Proxy Mode Disabled (Pure nginx Hosting)
In Plesk, you can host websites using a combination of nginx and PHP-FPM without using Apache.
If you want to use nginx without Apache to process web requests, disable the Proxy Mode. This causes nginx to handle all requests.
| Note: After enabling/disabling proxy mode, also check your PHP settings, especially the execution mode. nginx runs PHP exclusively with PHP-FPM. |
Known limitations
If you host a domain using only nginx, there are certain limitations:
- SSI, Perl, and Python are not supported.
- You can only use the PHP handler “FPM application served by nginx.”
- No special nginx configurations such as rewrite rules are possible.
- htaccess files are not considered by nginx.