How To Install Nginx on Ubuntu 16.04
Nginx is an open supply Linux internet server that accelerates content whereas utilizing low resources. Renowned for its performance and stability. Nginx has several alternative uses like load reconciliation, reverse proxy, mail proxy and communications protocol cache. With of these qualities it makes a precise competition for Apache. To put in Nginx follow our simple tutorial.
- Logged into an as root and are working on an Ubuntu 16.04 LTS server powered by Liquid Web! If using a different user with admin privileges use sudo before each command.
Installation of Nginx
Step 1: Update Apt-Get
As always, we update and upgrade our package manager.
Step 2: Install Nginx
One simple command to install Nginx is all that is needed:
Step 3: Verify Nginx Installation
When correctly installed Nginx’s default file will appear in /var/www/html as index.nginx-debian.html . If you see the Apache default page rename index.html file. Much like Apache, by default, the port for Nginx is port 80, which means that if you already have your a record set for your server’s hostname you can visit the IP to verify the installation of Nginx. Run the following command to get the IP of your server if you don’t have it at hand.
Take the IP given by the previous command and visit via HTTP. (http://xxx.xxx.xxx.xxx) You will be greeted with a similar screen, verifying the installation of Nginx!
Nginx, by default, does not execute PHP scripts and must be configured to do so.
Changing Ports for Apache
If you already have Apache established to port 80, you may find the Apache default page when visiting your host IP, but you can change this port to make way for Nginx to take over port 80. Change Apache’s port by visiting the Apache port configuration file:
Change “Listen 80” to any other open port number, for our example we will use port 8090.
Restart Apache for the changes to be recognized:
All things Apache can now be seen using your IP in the replacement of the x’s. For example http://xxx.xxx.xxx.xxx:8090