Nginx is free, open source HTTP server and reverse proxy. It is also a mail proxy server for IMAP/POP3. Nginx is high performance web server with a rich set of features, simple configuration style and low memory usage.
Using Nginx as a reverse proxy is a great idea for several reasons. Firstly it handles static content very well. It is able to handle the requests and serve static content much faster in our tests and this has cut our page load time in about half. Both nginx and apache are powerful and effective servers. Apache is known for it's power and Nginx is known for it's speed.
Common uses for a reverse proxy server include:
Load Balancing - A reverse proxy server sitting in front of your backend servers and distributing client requests across a group of servers in a manner that maximises speed and capacity utilisation whilst ensuring no single server is overloaded, which can degrade performance. If a server goes down, the load balancer redirects traffic to the remaining online servers.
Web Acceleration - Reverse proxies can compress inbound and outbound data, as well as cache commonly requested content, both of which speed up the flow of traffic between clients and servers.
Security and Anonymity - By intercepting requests headed for your backend servers, a reverse proxy server protects their identities and acts as an additional defense against security attacks.
In this tutorial, we will install and configure the Nginx web server as reverse proxy for Apache on Ubuntu-14.04. Apache will run on port 8080, then we will configure Nginx run on port 80 to receive a request from user, the request will then be forwarded to the apache server that is running on port 8080.
A server running Ubuntu-14.04.
A static IP Address for your server.
A non-root user account with sudo privilege set up on your server.
Let's start by making sure that your Ubuntu server is fully up to date.
You can update your server by running the following command:
sudo apt-get updatesudo apt-get upgrade
Firstly, you will need to install and configure Nginx which will serve the front end of your site.
Run the following command to install Nginx on terminal:
sudo apt-get install nginx
Once Nginx is installed, you will need to setup Nginx as reverse proxy.
You can do this by creating new virtual host file:
sudo nano /etc/nginx/sites-available/proxyhost
Add the following content:
index index.php index.html index.htm;
In the above file, The root directive specify the path of default document root directory. try_files attempts to serve whatever page the visitor requests. If nginx is unable, then the file is passed to the proxy.
proxy_pass defines the address of the proxied server. localtion directive block denies access to .htaccess file.
You can check Nginx configuration syntax by running the following command:
sudo nginx -t
You should see the following output if everything is ok:
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
Now, activate the virtual host by running the following command:
Next, you will need to install Apache for the backend. You can install Apache by running the following command:
sudo apt-get install apache2
Next, you will need to configure apache to take over the backend. Since Nginx is listening to 80 and we told it to pass the proxy to 8080 which should be where Apache is listening to receive a request. Let's tell Apache to listen to 8080 and leave 80 for Nginx.
Open up the apache ports file to start setting apache on the correct port:
You can create an email email filters through your cPanel control panel which is where you manage your hosting account. Email filters can be set up to target specific word, subject, from or to. Emails that are filtered out can be sent to a different email, deleted, delivered to a...
If you find your cPanel disk space filling up, or an email address has hit its disk space quota, cPanel has a helpful built in Email Disk Usage tool. This will provide you with a simple to understand breakdown of how much disk space each folder for a particular email...
Although WHM will normally automatically keep itself up to date, you may want to manually check for server updates / push through an update that is pending, or it may be that you have automatic updates switched off on your cPanel server. In this guide we will show you how...