Nginx pronounced Engine X is now enabled by default for all packages as a reverse proxy. The benefits of this type of caching are visible through an increase in the general speed and availability of your sites via caching. This works by saving a copy of site content, then returning this copy to the user directly. Removing the need to request and generate the content from the origin server every time a user visits a site. This is a much more efficient way of handling requests, especially on busy sites. Additionally, using Nginx reverse proxy can significantly reduce the load on your origin server. By serving this content directly to users, the server can handle more concurrent connections and maintain performance during traffic spikes. This leads to improved scalability and reliability, as the server is less likely to become overwhelmed during peak times.
An NGINX Reverse Proxy forwards client HTTP requests to one or more application servers. Imagine a river: on a standard non-proxy server, traffic flows straight from one end to the other. Too much water causes flooding. An NGINX proxy server works like a dam, splitting into controlled tributaries to optimize flow and prevent overflow.
Unlike a standard web server, a reverse proxy directly handles HTTP client requests for proxied servers, improving load balancing, security, and performance. On VPS or dedicated services, installing NGINX on Ubuntu allows configuration as a reverse proxy by editing the NGINX configuration file. This file lets you adjust proxy_pass
and proxy_set_header
directives to direct traffic to backend servers.
To set up an NGINX reverse proxy, create a server block in the configuration file specifying the domain name and localhost as endpoints. You can also set headers like proxy_add_forwarded_for
and proxy_set_header X-Forwarded-For
to maintain accurate client information. Combined with load balancing, this distributes HTTP requests evenly across servers, boosting performance and efficiency.
nginx reverse proxy configuration also involves setting headers like proxy_add_x_forwarded_for and proxy_set_header x-forwarded-for to ensure accurate client information is forwarded. Additionally, nginx uses load balancer capabilities to distribute incoming http requests evenly across multiple servers, enhancing efficiency and reliability.
Overall, enabling Nginx as a reverse proxy by default provides a robust solution for improving site speed, reducing server load, and enhancing the overall user experience. It is a powerful tool for web administrators looking to optimize their infrastructure and ensure their sites remain fast and responsive under varying loads.
On occasion, Nginx will need to be disabled or cleared. A great example is during the active development of a site. You might need changes to appear immediately, because of how nginx works it might be best to disable nginx entirely for the duration of development.
This guide outlines how to do this from your cPanel control panel, so you must first log in to cPanel.
1. First off, from the main cPanel overview screen, navigate to the general information panel.
2. To enable the cache, click the highlighted radio button and a small spinning icon will appear.
3. Caching is active when the button appears blue and “Active” appears.
1. To disable caching, click the highlighted button below, the loading icon indicates it is working.
2. Caching is disabled when the button appears clear and the text “Inactive” appears. It will also remove the “Clear Cache” button.
1. Clearing the cache is simple, just click the “Clear Cache” button as indicated below. If the cache clean-up is successful, a green banner will appear above.
This guide outlines how to manage Nginx from Plesk control panel, so you must first access control panel.
1. First off from your Plesk subscription click on “Hosting & DNS” and then click on “Apache & nginx” as shown below.
2. Moving on scroll down until you can see “Enable nginx caching” (highlighted below) if this is unticked as shown it means the Nginx cache is currently disabled for this domain in Plesk.
2. Finally, following on from above using the screenshot below tick the checkbox [1] to enable Nginx and then apply [2] to activate the cache for this domain. To disable repeat the process.
1. Clearing the cache is straightforward following on from above under the Enable nginx caching button a just click “Clear cache” as highlighted below.