How to install NGINX on ubuntu

By: Sunil Kumar |  In: Server  |  Last Updated: 2018/07/21

How to install NGINX on ubuntu

Nginx is the most popular web server which can also be used as a reverse proxy, load balancer, mail proxy and HTTP cache.
Currently, NGINX is serving some of the most popular and high traffic websites on the internet. NGINX is feature rich and resource friendly.
In this guide, we will learn How to get Nginx installed on the Ubuntu server.

Step 1: Install Nginx

Nginx package is included in Ubuntu default repositories. Before installing new package update your ubuntu server with

$ sudo apt-get update

Now install Nginx

$ sudo apt-get install nginx

Now Nginx and all of its dependencies will be installed on your ubuntu server.

Step 2: Check web server

Now after the installation process, the web server should already be up and running.
We can check the status of Nginx server with

$ sudo service nginx status

nginx status
Now you can see the Nginx is up and running successfully. You can also request a testing page from Nginx to check the Nginx is actually working.
If it shows Nginx is not running you can start it with

$ sudo service nginx start

You can access the default Nginx landing page with the server domain name or the IP address.
If you are setting up this on your local server you can access it with
Now you will see the Nginx default page which should look like this
Welcome to nginx

Step 3: Managing Nginx Process

Now as we have installed Nginx on our server and its running well we can try some basic Nginx management commands
To stop your Nginx server

$ sudo service nginx stop

And start the Nginx server

$ sudo service nginx start

And restart the Nginx server with a single command

$ sudo service restart nginx

If you are making some configuration changes, it can reload its services without going down and drop the connections.

$ sudo service nginx reaload

In Ubuntu, Nginx is configured to start automatically whenever you restart the system. If you want to stop this behavior you can do it by

$ sudo update-rc.d -f nginx disable

And to enable back this service

$ sudo update-rc.d -f nginx enable


Now as we have installed Nginx successfully on our Ubuntu server we can configure our first website on Nginx to experience new technology with a whole new web server.


Leave a Comment

Your email address will not be published.


Sunil Kumar

I am the owner of acmeextension. I am a passionate writter and reader. I like writting technical stuff and simplifying complex stuff.
Know More

Join more than 10,000 others Web Developers