...

Open source softwares - NGINX

Back to Course

Lesson Description


Lession - #613 Installing NGINX on Debian/Ubuntu


Installing NGINX on Debian/Ubuntu

There are two ways to install NGINX:
  • Utilizing a pre-fabricated paired: - This strategy is a lot of most straightforward and quicker technique.
  • Developing it from source: - This strategy gives the capacity to incorporate different outsider modules that make Nginx significantly more impressive.
Following are the steps which will show us how to install Nginx on our Debian or Ubuntu system: Stage 1: First of all, how about we update our nearby bundle file so we approach the latest bundle postings. Open the terminal on Ubuntu or Debian and run the accompanying order to guarantee that all bundles on the OS are up to date:

sudo apt-get update  




Since Nginx is accessible in the default storehouse of Debian or Ubuntu, it is feasible to introduce it from these vaults utilizing the well-suited bundling framework.


sudo apt-get install nginx  




Once it is done, use the following command to see the process for the webserver in a running state.


ps ?ef | grep nginx  






Adjusting the firewall to access Nginx

For getting to the Nginx from the web server, we need to permit admittance to the administrations from outside. To see the rundown of profiles accessible to permit from the firewall, utilize the accompanying order:



Here, Nginx Full: It allows both ports 80 and 443. Nginx HTTP: It allows only the port 80. Nginx HTTPS: It allows only port 443. To allow both ports HTTP 80 and HTTPS 443 then use the following command:


sudo ufw allow 'Nginx Full'  


To allow only Nginx HTTP port 80 use the following command:


sudo ufw allow 'Nginx HTTP'  




To allow only Nginx HTTPS port 443, use the following command:

sudo ufw allow 'Nginx HTTPS'  


Checking the NGINX Service Status

Of course, after the establishment of Ubuntu, the Nginx begins consequently and we can actually look at the situation with the Nginx with the assistance of the accompanying order:

systemctl status nginx  



systemctl status nginx  


nginx.service - A high-performance web server and a reverse proxy server Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled>
Active: active (running>
since Mon 2016-04-18 16:14:00 EDT; 4min 2s ago Main PID: 12857 (nginx>
CGroup: /system.slice/nginx.service ├─12857 nginx: master process /usr/sbin/nginx -g daemon on; master_process on └─12858 nginx: worker process



We can see from the abovementioned, the help seems to have begun effectively. In any case, the most ideal way to test this is to demand a page from Nginx. We can get to the default Nginx page to ensure that the product is running appropriately. We can get to this through our server's space name or IP address. Or on the other hand we can utilize http://localhost on Windows. We ought to see the "Welcome to Nginx" default page. In the event that we see that page, we should rest assured that Nginx has been introduced appropriately.