Language:

Search

How To Install Nginx Server on Ubuntu

  • Share this:
How To Install Nginx Server on Ubuntu

First, it is recommended to update your system with latest version.
You can do it with the following command:

sudo apt-get update -y
sudo apt-get upgrade -y


Nginx Install      
 

You can install nginx command:

sudo apt install nginx

 

Check Status Nginx Service (active or inactive)

sudo systemctl status nginx

Output the Command Line:

nginx-service-status
 


List of the Application configuration ufw. You can do it with the following command:

sudo ufw app list

Output the Command Line:
ufw-applications-list

Three property available for Nginx:     

  • Nginx Full - this property opens two ports 80 (http port),443 (https port)
  • Nginx HTTP - this property opens only 80 port
  • Nginx HTTPS - this property opens only 443 port (TLS/SSL encrypted)


if Firewall Enabel     

sudo ufw allow 'Nginx HTTP'

Check Status command (Enabel or Disable)

sudo ufw status

Output the Command Line:

ufw-status
 


go to the browser and type your ip address of localhost

http://localhost

Output the browser

nginx-browse-localhost-
 


Some Important Command Line in Nginx Server

When you Nginx service start with the following command line

sudo systemctl start nginx

When you Nginx service stop with the following command line

sudo systemctl stop nginx

if you change Nginx configuration file 

When your Nginx service restart with the following command line

sudo systemctl restart nginx

When you change the Nginx configuration file.  You need to reload Nginx without dropping connections instead of restarting it. To do this, type the following command:

sudo systemctl reload nginx

Default Nginx Service start automatically when the server boot. if you no want start automatically. To do this, type the following command:

sudo systemctl disable nginx

Nginx service start automatically when the server boot.  To do this, type the following command:

sudo systemctl enable nginx

 


Farhan Tanvir

Farhan Tanvir