0% found this document useful (0 votes)
145 views9 pages

NGINX Web Server Installation

The document provides instructions for installing Nginx on Ubuntu server in 3 steps: 1. Update all packages with "sudo apt-get update" 2. Install Nginx with "sudo apt-get install nginx" 3. Check that Nginx is running with "systemctl status nginx"

Uploaded by

Gurdarshan Singh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
145 views9 pages

NGINX Web Server Installation

The document provides instructions for installing Nginx on Ubuntu server in 3 steps: 1. Update all packages with "sudo apt-get update" 2. Install Nginx with "sudo apt-get install nginx" 3. Check that Nginx is running with "systemctl status nginx"

Uploaded by

Gurdarshan Singh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 9

NGINX Web Server Installation

Install Ubuntu server

Open the terminal on Ubuntu and run the following command to ensure that all packages on
the OS are up to date:

$ sudo apt-get update  

Since Nginx is available in the default repository of Ubuntu, it is possible to install it from
these repositories using the apt packaging system.

$ sudo apt-get install nginx 
next →← prev

Installing NGINX on Debian/Ubuntu


There are two ways to install NGINX:

o Using a pre-built binary: - This method is much easiest and faster method.
o Building it up from source: - This method provides the ability to include various
third-party modules that make Nginx even more powerful.

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:

1. sudo apt-get update  
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.

1. sudo apt-get install nginx  
Once it is done, use the following command to see the process for the webserver in a
running state.

1. ps -ef | grep nginx  
Adjusting the firewall to access Nginx
For 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:

$ 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


By 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:

$ systemctl status 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 IP address.

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.

Now all you have to do is create a Web Page and save it.

Then go the directory /etc/nginx

$cd /etc/nginx

Then edit a file nginx.conf and clear all the content and configure with your web page:

$ vi nginx.conf

Replace with this:

http {

include mime.types;

server {

listen “Server IP”;

listen 80;

server_name “example.com”;

root “Path of your website page”;

}
After saving this file we need to restart the NGINX services and check the status:

$ systemctl restart nginx.services

We can access our Web page to make sure that its working fine. We can access this through
our server's IP address.

You might also like