One of the best options to improve performance and security for your websites is to use Nginx. Unfortunately, the default installation of cPanel does not ship with Nginx. In this guide, we’ll explain how to install Nginx on cPanel servers using an open source software called Engintron.
A reverse proxy provides a layer of hardware abstraction which makes it easier to ensure that users have constant access to the content they have requested. In cases where the reverse proxy server sits behind a firewall in a private server network, it is also extremely secure.
One of the best ways to improve the performance and security of a web server it to install a reverse proxy server. It acts as an intermediary server that forwards requests for content from multiple clients to other backend servers.
There are a several reasons to run nginx as a reverse proxy on your servers:
Improved server performance
A reverse proxy can compress inbound/outbound data and cache the content that is frequently used by the server, which speeds up server requests. It can also perform tasks like SSL encryption and the serving of static content, which further reduces the load on your web server.
Improved Security
Reverse proxies are useful for hiding the topology and technical details of back-end servers, which reduces the risk of server intrusions by malicious third parties. Your back end servers won’t be accessible directly via the Internet, which provides an additional layer of protection.
Load Balancing
Having a reverse proxy makes it simple to distribute user requests across multiple backend servers. This increases server speed and stability by ensuring no single server is overloaded. If a server does experience a technical issue, traffic can automatically be directed to other backend servers. This great article goes into more detail on the benefits of using nginx..
Why Is Nginx A Great Reverse Proxy?
Nginx is a high-performance web server that is fast, lightweight, and simple to configure. The key difference between Nginx and Apache is that Nginx is event-based while Apache is process-based. Nginx will not spawn new processes for each request, which means it uses less memory for concurrent requests and serves static files faster than Apache.
In addition to being a world class web server, Nginx can operate as a reverse proxy, mail proxy, load balancer, and HTTP cache. Its versatility, excellent performance, and small footprint are the reason why it is considered a best-in-class option currently available.
cPanel is the world’s leading web server control panel. It provides users with dozens of powerful features and an easy-to-use interface which makes managing a server simple. However, it does not come with Nginx, so we need to install it. The easiest way to do so is by using a third party cPanel plugin, like Engintron.
To install Engintron, you will need root SSH access to your cPanel server. Once you have logged in, execute the following commands:
cd /; rm -f engintron.sh; wget --no-check-certificate https://raw.githubusercontent.com/engintron/engintron/master/engintron.sh; bash engintron.sh install
It will take several minutes for the installation to complete.
If you are using CloudFlare for any of your websites, apply the following changes depending on your setup:
A. If you server has only one IP Address, edit the file /etc/nginx/custom_rules and append the following line at the bottom of the file:
set $PROXY_DOMAIN_OR_IP "XXX.XXX.XXX.XXX";
Add your servers main public IP Address between the double brackets “XXX”
B. If your server has more than 1 IP Address, edit /etc/nginx/custom_rules, in addition to “A” configuration above, append the following line for EACH of your domains having a dedicated IP:
if ($host ~ "example.com") {
set $PROXY_DOMAIN_OR_IP "XXX.XXX";
}
Once you finish the installation, head over to your WHM control panel and log in. You will now see Engintron in the plugins section.
Click on the Engintron link to view the options that are available. You also have complete control over Nginx’s configuration files. Engintron will automatically setup Nginx to speed up delivery of both static and dynamic content.
You can also find some useful utilities in the Engintron settings, including access/error logs and server monitoring. If you require more information, view Engintron documentation and Nginx documentation.
Furthermore, you may read our article for bad bot blocking for nginx in order to further secure your server. If you wish to install and configure nginx on your cPanel server, see our cpanel server management plans.
Thanks for reading our tutorial Install Nginx on cPanel. In the next article, I’ll share some essential information for using nginx rules to limit abusive behaviour towards websites.
These cookies relate to the storage of (or access to) information either for the sole purpose of carrying out the transmission of a communication over an electronic communications network or in order for us to provide a service explicitly requested by you. Necessary cookies are absolutely essential for the website to function properly. These cookies ensure basic functionalities and security features of the website, anonymously.
These cookies are exempt from the requirement of consent, which means that you cannot reject their use, since it would not be possible for us to provide our services.
Cookie | Type | Duration | Description | Cookie ID |
---|---|---|---|---|
cookielawinfo-checkbox-advertisement | 1 | 11 months 29 days 23 hours 59 minutes | The cookie is set by GDPR cookie consent to record the user consent for the cookies in the category ''Advertisement''. | cookielawinfo-checkbox-advertisement |
cookielawinfo-checkbox-analytics | 1 | 11 months 29 days 23 hours 59 minutes | This cookies is set by GDPR Cookie Consent WordPress Plugin. The cookie is used to remember the user consent for the cookies under the category ''Analytics''. | cookielawinfo-checkbox-analytics |
cookielawinfo-checkbox-necessary | 0 | 11 months | The cookie is set by the GDPR Cookie Consent plugin and is used to store whether or not a user has consented to the use of cookies. It does not store any personal data. | cookielawinfo-checkbox-necessary |
cookielawinfo-checkbox-non-necessary | 0 | 11 months | This cookie is set by GDPR Cookie Consent plugin. The cookies is used to store the user consent for the cookies in the category "Non Necessary". | cookielawinfo-checkbox-non-necessary |
cookielawinfo-checkbox-other | 1 | 11 months 29 days 23 hours 59 minutes | No description | cookielawinfo-checkbox-other |
viewed_cookie_policy | 0 | 11 months | The cookie is set by the GDPR Cookie Consent plugin and is used to store whether or not a user has consented to the use of cookies. It does not store any personal data. | viewed_cookie_policy |
wp_woocommerce_session_9395ef9dc7e3839eb429f53aa1742b7d | 1 | 1 days 23 hours 59 minutes | This cookie is set by Woocommerce to keep track of cart items. | wp_woocommerce_session_9395ef9dc7e3839eb429f53aa1742b7d |
These cookies collect information about the way you use the Website, e.g. the pages you visit the most, the website from which your visit originated and other related information. These cookies collect aggregate, anonymous, statistical data which cannot be used to identify visitors individually. They are used for the sole purpose of analysing traffic and improving the Website performance.
Cookie | Type | Duration | Description | Cookie ID |
---|---|---|---|---|
_ga | 1 | 1 years 11 months 28 days 23 hours 59 minutes | This cookie collects information on how visitors use the website and their storage duration is defined by Google’s usage policy. Google Analytics’ cookies collect certain information, including a pseudonymized IP address, the number of visitors to the Website, where they came from, and the pages they visited within the Website. We use the information to compile reports that help us improve our Website. For more information please see Google privacy policy | _ga |
_gid | 1 | 23 hours 59 minutes | This cookie collects information on how visitors use the website and their storage duration is defined by Google’s usage policy. Google Analytics’ cookies collect certain information, including a pseudonymized IP address, the number of visitors to the Website, where they came from, and the pages they visited within the Website. We use the information to compile reports that help us improve our Website. For more information please see Google privacy policy | _gid |
These cookies are used to track your behavior across websites and deliver adverts more relevant to you and your interests. They are also used to limit the number of times you see an advertisement as well as help measure the effectiveness of the advertising campaign. They remember that you have visited our Website and this information is shared with other organisations such as advertisers.
Cookie | Type | Duration | Description | Cookie ID |
---|---|---|---|---|
fr | 1 | 2 months 28 days 23 hours 59 minutes | The cookie is set by Facebook to show relevant advertisments to the users and measure and improve the advertisements. The cookie also tracks the behavior of the user across the web on sites that have Facebook pixel or Facebook social plugin. | fr |
_fbp | 1 | 2 months 28 days 23 hours 59 minutes | This cookie is set by Facebook to deliver advertisement when they are on Facebook or a digital platform powered by Facebook advertising after visiting this website. | _fbp |