Installing NGINX on Debian/UbuntuThere are two ways to install NGINX:
Following are the steps which will show us how to install Nginx on our Debian or Ubuntu system: Step 1: First of all, let's update our local package index so that we have access to the most recent package listings. Open the terminal on Ubuntu or Debian and run the following command to ensure that all packages on the OS are up to date: Since Nginx is available in the default repository of Debian or Ubuntu, it is possible to install it from these repositories using the apt packaging system. Once it is done, use the following command to see the process for the webserver in a running state. Adjusting the firewall to access NginxFor accessing the Nginx from the web server, we have to allow access to the services from outside. To see the list of profiles available to allow from the firewall, use the following command: 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: To allow only Nginx HTTP port 80 use the following command: To allow only Nginx HTTPS port 443, use the following command: Checking the NGINX Service StatusBy default, after the installation of Ubuntu, the Nginx starts automatically and we can check the status of the Nginx with the help of the following command: 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 above, the service appears to have started successfully. However, the best way to test this is to request a page from Nginx. We can access the default Nginx page to make sure that the software is running properly. We can access this through our server's domain name or IP address. Or we can use http://localhost on Windows. We should see the "Welcome to Nginx" default page. If we see that page, then we can be sure that Nginx has been installed properly. This page is normally included with Nginx to show us that the server is running properly. |