How to Install Nginx on Ubuntu 14.04 LTS

When it comes to high performance and stability  along with  free and open-source, Nginx is the best web server software to choose. It is mostly popular for its stability, simplicity in configuration and low resource consumption. As  compared to Apache, it is considered to be more resource friendly.

You can follow these steps  to install Nginx on Ubuntu 14.04 server. But make sure You  have user with sudo privileges on your server if you don’t have root access.

 

Installation of Nginx

As the Ubuntu itself has an Nginx package in its default repositories which makes it  pretty much easy to install.

You must update the local package index before installing Nginx for the most up-to-date information.

sudo apt-get updatesudo apt-get install nginx

While the installation progresses, you may have to enter user’s password to complete the process. Nginx will be downloaded and automatically installed on to your server.

 

Verifying the Web Server

Once the installation is completed You can verify whether or not Nginx is successfully installed by simply visiting your server’s domain name or IP address in your browser. To check the server’s public IP address, you can run this command from your command prompt:

ip addr show eth0 | grep inet | awk '{ print $2; }' | sed 's/\/.*$//'

Another simplest way is

curl http://icanhazip.com

You just have to enter the server IP address into your web browser’s address bar:

http://server_IP_address

You should be taken to the default nginx landing page which will look similar to this:

welcometonginx

 

The display of this default page will ensure that the server is installed properly.

 

Managing Nginx Processes

You can manage by running these commands after you have nginx installed and running on your server,

To stop

sudo service nginx stop

To start :

sudo service nginx start

To restart web server. It will stop first and then start the service again:

sudo service nginx restart

To start the service whenever the service boots :

sudo update-rc.d nginx defaults

This may show you a message like this:

System start/stop links for /etc/init.d/nginx already exist.

which means it  may have already been enabled.

 

KB Admin has written 46 articles