As a leading web hosting control panel, cPanel offers users with numerous features and choices that they otherwise are not going to enjoy with other similar tools and services. Its default server, Apache, just adds to the convenience and intuitiveness of the system.
However, this does not mean that users are required to stick to the default server. They have the option to utilize their preferred servers, such as Nginx.
And while native support is not offered by cPanel/WHM for Nginx, it can be installed and configured so that server performance can be considerably boosted.
The Key Difference Between the Two Cross-Platform Servers
For those who are wondering what distinguishes the two, the key difference is that, cPanel’s default is process-based, while Nginx is event-based.
So far, Nginx is one, if not the best-known asynchronous servers in the industry today. And there is no doubt that Apache is the leader when it comes to process-based services. The key benefit of utilizing asynchronous servers is the great level of scalability, whereas process-based servers follow a process that results in considerable overhead.
Running Apache and Nginx Together
Apache and Nginx are definitely powerful, efficient, and robust web-servers. Much thanks to the high level of flexibility that cPanel possesses, users can actually take advantage of the astounding features and functionalities of both servers at the same time. In other words, Apache and Nginx can be run together.
When Apache’s power is combined with Nginx’s speed, the results can be very useful and helpful to cPanel users. Nginx, when used as a reverse proxy, can considerably boost both the performance and the speed of the website. They work well together, with Nginx taking care of all the site’s static contents, including CSS, MP4, SWF files, images, etc., and Apache dealing with other dynamic requests.
The process of running both web-servers, with Nginx functioning as a site’s front-end server and Apache functioning as a back-end server, is referred to as the Nginx reverse proxy setup.
Nginx Features
As a leading web-server, users can expect many different useful features from Nginx. In fact, it shares many of the functionalities and qualities that made Apache the best process-based server.
Some of the features incorporated into Nginx include the following:
- Access Controls
- Compression
- Custom Logging
- FastCGI
- FLV Streaming
- Limited WebDAV
- Load Balancing
- Reverse Proxying
- Static File Serving.
- Support for SSL/TLS
- Virtual Hosts
- URL Rewriting
In addition, cPanel users can also expect this event-based server to be highly secure, stable, and user-friendly. In many cases, Nginx is recommended for those who want to get the most out of their VPS or have the need to scale very large sites. Combining it with the undeniable power of Apache can make website administration easier, faster, and more efficient.
Setting Up Nginx as a Reverse Proxy
The following are the steps that need to be completed in order to successfully set up Nginx as a reverse proxy on the web host control panel.
- Edit SSH to server as root.
- Use ‘/usr/local/src’ as the directory (cd /usr/local/src).
- Get the latest and most up-to-date nginxadmin package.
- wget http://nginxcp.com/latest/nginxadmin.tar
- tar xf nginxadmin.tar
- cd publicnginx
- ./nginxinstaller install
- Install the newly downloaded package.
Once installation has completed, the Nginx Admin plugin should already be available in WHM. The Nginx process should already be running. This can be confirmed by running the command ‘ps aux | grep nginx’.
In the event that no process is shown, close httpd and have httpd restarted by running the following commands:
- killall -9 httpd
- /etc/init.d/httpd restart
Uninstalling Nginx Admin Plugin
For users who are not quite satisfied, which is unlikely to happen, with running both Apache and Nginx, uninstalling the plugin can be done through the following commands:
- cd /usr/local/src
- wget http://nginxcp.com/latest/nginxadmin.tar
- tar xf nginxadmin.tar
- cd publicnginx
- ./nginxinstaller uninstall
Reminders
The Nginx Admin plugin should be on port 80, while the Apache plugin should be on another port, such as 8080. This way, both web-servers can be run and their beneficial functions enjoyed.