SlideShare a Scribd company logo
3
Most read
6
Most read
INSTALL NGINX
ON UBUNTU
21.04 SERVER
Nginx is open-source, high-
performance Web server.
Prepared by: Satish Kumar
Founder, LinuxConcept
LINUXCONCEPT
LINUXCONCEPT
LINUXCONCEPT
https://linuxconcept.com/how-to-install-nginx-on-ubuntu-21-04-server/
LINUXCONCEPT
Nginx is the most potent, open-source, and a high-
performance Web server. It can work as a reverse proxy
server also, nowadays, is used by most of the most
significant websites on the internet.
People pronounced “engine x” for Nginx; it is the hot
choice for every website owner to power their site with
Nginx.
In comparison to the Apache web server, Nginx is
capable of handling more connections with a few
amount of memory footprint in each connection.
Prerequisites
Make sure your Linux box does not have an Apache
HTTP server or any application service running on port
80 and 443. You should have sudo privileges to execute
commands on your Linux machine.
https://linuxconcept.com/how-to-install-nginx-on-ubuntu-21-04-server/
LINUXCONCEPT
INSTALL NGINX
Nowadays, Nginx software packages built-in Ubuntu default
software repository, so the installation is effortless, You just
run the following commands in terminal:
# sudo apt update
# sudo apt install nginx
After installation of Nginx, you can check the status of the
Nginx service by using the following command:
# sudo systemctl status nginx
The output of the above command should show that the Nginx
service is running:
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 Sun 2020-22-06 15:44:04
UTC; 1min 59s ago
Main PID: 1461 (nginx)
CGroup: /system.slice/nginx.service
├─1461 nginx: master process /usr/sbin/nginx -g
daemon on; master_process on
└─1463 nginx: worker process
You can also check the version of Nginx Web server, using the
following command:
# sudo nginx -v
nginx version: nginx/1.14.0 (Ubuntu)
https://linuxconcept.com/how-to-install-nginx-on-ubuntu-21-04-server/
LINUXCONCEPT
FIREWALL CONFIGURATION
Today, we all are using the UFW firewall to manage network
connection and traffic on the Ubuntu machine. To use Nginx,
you will need to open HTTP Port (80) and HTTPS port (443).
You can open HTTP and HTTPS port by enabling “Nginx Full”
profile on UFW:
# sudo ufw allow 'Nginx Full'
You can verify the firewall configuration using below
command:
# sudo ufw status
The output of the above command is something like below:
Status: active
To Action From
-- ------ ----
22/tcp ALLOW Anywhere
Nginx Full ALLOW Anywhere
22/tcp (v6) ALLOW Anywhere (v6)
Nginx Full (v6) ALLOW Anywhere (v6)
https://linuxconcept.com/how-to-install-nginx-on-ubuntu-21-04-server/
LINUXCONCEPT
Nginx Installation Test
You can verify that installed Nginx is working as expected by
opening in your browser with your IP (http://your-IP). You will get
the browser screen with default Nginx welcome page, as shown
below:
https://linuxconcept.com/how-to-install-nginx-on-ubuntu-21-04-server/
LINUXCONCEPT
Install Nginx using Nginx PPA Repository
The Ubuntu default software repository is not updating
packages regularly, so it often outdated. To install Nginx’s
latest version, use Nginx’s official PPA repository.
To install Nginx using PPA repository in Ubuntu 21.04, follow
below steps:
01. install “software-properties-common” in Ubuntu system
# sudo apt install software-properties-common
02. Add Nginx’s PPA repository using following command
# sudo add-apt-repository ppa:nginx/stable
03. Update package manager with list and install Nginx using
following command:
# sudo apt update
# sudo apt install nginx
04. After completing the installation of Nginx, check the
version of installed Nginx
# sudo nginx -v
nginx version: nginx/1.17.0
https://linuxconcept.com/how-to-install-nginx-on-ubuntu-21-04-server/
LINUXCONCEPT
Manage Nginx service with systemctl
You can manage Nginx services with the similar command what
use to manage other system services.
Start the Nginx Service:
# sudo systemctl start nginx
Stop the Nginx Service:
# sudo systemctl stop nginx
Restart the Nginx Service:
# sudo systemctl restart nginx
Reload the Nginx Service:
# sudo systemctl reload nginx
Enable the Nginx Service to start at boot:
# sudo systemctl enable nginx
Disable the Nginx Service to not start on boot:
# sudo systemctl disable nginx
https://linuxconcept.com/how-to-install-nginx-on-ubuntu-21-04-server/
LINUXCONCEPT
The Nginx configuration files will always remain in the
“/etc/nginx/” directory.
The main Nginx’s setting files located at
“/etc/nginx/nginx.conf.”
To keep Nginx configuration is simple by configuring
separate files for each site. You can keep as much as you
want with a configuration file with a server block.
Nginx server block files or site configuration files stored in
the “/etc/nginx/sites-available/” directory. To make these
files in use on Nginx, link the files in the “/etc/nginx/sites-
enable/” directory.
To activate any new site configuration, we need to create a
symlink of site configuration file available in the “sites-
available” directory to the “sites-enabled” directory.
To identify the site’s configuration, follow the standard
naming conversion for server block files. For example, you
have a site testweb.com. It is better to create a file as
“/etc/nginx/sites-available/testweb.com.conf” to identify
quickly when you have multiple sites configured in the Nginx
web server.
Nginx configuration file’s structure on Ubuntu
https://linuxconcept.com/how-to-install-nginx-on-ubuntu-21-04-server/
LINUXCONCEPT
/home/<user>/<site-name>
/var/www/<site-name>
/var/www/html/<site-name>
/opt/<site-name>
There is no boundry to configure domain document root
directory, you can set any location you want. But the most
recommended location for web root directory are:
Conclusion
Congratulation; now you have installed the Nginx Web server
on your Ubuntu 21.04 server. Now, you are ready to deploy
and run your application using Nginx as a web server or
reverse proxy server.
https://linuxconcept.com/how-to-install-nginx-on-ubuntu-21-04-server/
LINUXCONCEPT
THANK YOU
You can check our website https://linuxconcept.com for
more similar information on Linux or opensource
technologies.
https://linuxconcept.com/how-to-install-nginx-on-ubuntu-21-04-server/

More Related Content

PDF
How to Set Up Nginx Server Blocks on Ubuntu 2404.pdf
PDF
NGINX ADC: Basics and Best Practices
PPTX
NGINX: Basics & Best Practices - EMEA Broadcast
PDF
ITB2019 NGINX Overview and Technical Aspects - Kevin Jones
PPTX
NGINX: Basics and Best Practices
PDF
NGINX ADC: Basics and Best Practices – EMEA
PPTX
NGINX 101 - now with more Docker
PPTX
NGINX 101 - now with more Docker
How to Set Up Nginx Server Blocks on Ubuntu 2404.pdf
NGINX ADC: Basics and Best Practices
NGINX: Basics & Best Practices - EMEA Broadcast
ITB2019 NGINX Overview and Technical Aspects - Kevin Jones
NGINX: Basics and Best Practices
NGINX ADC: Basics and Best Practices – EMEA
NGINX 101 - now with more Docker
NGINX 101 - now with more Docker

Similar to Install nginx on ubuntu 21.04 server (20)

PPTX
Nginx A High Performance Load Balancer, Web Server & Reverse Proxy
PDF
How to Get Started With NGINX
PDF
Стажировка 2015. Разработка. Занятие 5. Использование nginx
PDF
NGINX: Basics and Best Practices EMEA
PPTX
Nginx [engine x] and you (and WordPress)
PPTX
NGINX Installation and Tuning
PPTX
NGINX Basics and Best Practices Workshop
PPTX
NGINX: Back to Basics – APCJ
PDF
PPTX
Nginx-deploy on linux server with 80 and 442
PPTX
Nginx as a Revers Proxy for Apache on Ubuntu
PPTX
DOCX
Installing lemp with ssl and varnish on Debian 9
PDF
Deploying nginx with minimal system resources
PPTX
One click deployment
ODP
Introduction to Nginx
PDF
Speed up your development environment PHP + Nginx + Fedora + PG
PDF
NginX - good practices, tips and advanced techniques
DOC
Nginx 0.8.x + php 5.2.13 (fast cgi) setup web server
PPTX
NGINX Basics: Ask Me Anything – EMEA
Nginx A High Performance Load Balancer, Web Server & Reverse Proxy
How to Get Started With NGINX
Стажировка 2015. Разработка. Занятие 5. Использование nginx
NGINX: Basics and Best Practices EMEA
Nginx [engine x] and you (and WordPress)
NGINX Installation and Tuning
NGINX Basics and Best Practices Workshop
NGINX: Back to Basics – APCJ
Nginx-deploy on linux server with 80 and 442
Nginx as a Revers Proxy for Apache on Ubuntu
Installing lemp with ssl and varnish on Debian 9
Deploying nginx with minimal system resources
One click deployment
Introduction to Nginx
Speed up your development environment PHP + Nginx + Fedora + PG
NginX - good practices, tips and advanced techniques
Nginx 0.8.x + php 5.2.13 (fast cgi) setup web server
NGINX Basics: Ask Me Anything – EMEA
Ad

Recently uploaded (20)

PDF
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
PDF
Sports Quiz easy sports quiz sports quiz
PPTX
master seminar digital applications in india
PPTX
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
PDF
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
PPTX
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
PPTX
Lesson notes of climatology university.
PPTX
Renaissance Architecture: A Journey from Faith to Humanism
PDF
TR - Agricultural Crops Production NC III.pdf
PPTX
Cell Structure & Organelles in detailed.
PDF
FourierSeries-QuestionsWithAnswers(Part-A).pdf
PDF
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
PDF
RMMM.pdf make it easy to upload and study
PDF
2.FourierTransform-ShortQuestionswithAnswers.pdf
PDF
Basic Mud Logging Guide for educational purpose
PDF
Anesthesia in Laparoscopic Surgery in India
PDF
O5-L3 Freight Transport Ops (International) V1.pdf
PDF
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
PPTX
human mycosis Human fungal infections are called human mycosis..pptx
PDF
Complications of Minimal Access Surgery at WLH
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
Sports Quiz easy sports quiz sports quiz
master seminar digital applications in india
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
Lesson notes of climatology university.
Renaissance Architecture: A Journey from Faith to Humanism
TR - Agricultural Crops Production NC III.pdf
Cell Structure & Organelles in detailed.
FourierSeries-QuestionsWithAnswers(Part-A).pdf
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
RMMM.pdf make it easy to upload and study
2.FourierTransform-ShortQuestionswithAnswers.pdf
Basic Mud Logging Guide for educational purpose
Anesthesia in Laparoscopic Surgery in India
O5-L3 Freight Transport Ops (International) V1.pdf
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
human mycosis Human fungal infections are called human mycosis..pptx
Complications of Minimal Access Surgery at WLH
Ad

Install nginx on ubuntu 21.04 server

  • 1. INSTALL NGINX ON UBUNTU 21.04 SERVER Nginx is open-source, high- performance Web server. Prepared by: Satish Kumar Founder, LinuxConcept LINUXCONCEPT LINUXCONCEPT LINUXCONCEPT https://linuxconcept.com/how-to-install-nginx-on-ubuntu-21-04-server/
  • 2. LINUXCONCEPT Nginx is the most potent, open-source, and a high- performance Web server. It can work as a reverse proxy server also, nowadays, is used by most of the most significant websites on the internet. People pronounced “engine x” for Nginx; it is the hot choice for every website owner to power their site with Nginx. In comparison to the Apache web server, Nginx is capable of handling more connections with a few amount of memory footprint in each connection. Prerequisites Make sure your Linux box does not have an Apache HTTP server or any application service running on port 80 and 443. You should have sudo privileges to execute commands on your Linux machine. https://linuxconcept.com/how-to-install-nginx-on-ubuntu-21-04-server/
  • 3. LINUXCONCEPT INSTALL NGINX Nowadays, Nginx software packages built-in Ubuntu default software repository, so the installation is effortless, You just run the following commands in terminal: # sudo apt update # sudo apt install nginx After installation of Nginx, you can check the status of the Nginx service by using the following command: # sudo systemctl status nginx The output of the above command should show that the Nginx service is running: 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 Sun 2020-22-06 15:44:04 UTC; 1min 59s ago Main PID: 1461 (nginx) CGroup: /system.slice/nginx.service ├─1461 nginx: master process /usr/sbin/nginx -g daemon on; master_process on └─1463 nginx: worker process You can also check the version of Nginx Web server, using the following command: # sudo nginx -v nginx version: nginx/1.14.0 (Ubuntu) https://linuxconcept.com/how-to-install-nginx-on-ubuntu-21-04-server/
  • 4. LINUXCONCEPT FIREWALL CONFIGURATION Today, we all are using the UFW firewall to manage network connection and traffic on the Ubuntu machine. To use Nginx, you will need to open HTTP Port (80) and HTTPS port (443). You can open HTTP and HTTPS port by enabling “Nginx Full” profile on UFW: # sudo ufw allow 'Nginx Full' You can verify the firewall configuration using below command: # sudo ufw status The output of the above command is something like below: Status: active To Action From -- ------ ---- 22/tcp ALLOW Anywhere Nginx Full ALLOW Anywhere 22/tcp (v6) ALLOW Anywhere (v6) Nginx Full (v6) ALLOW Anywhere (v6) https://linuxconcept.com/how-to-install-nginx-on-ubuntu-21-04-server/
  • 5. LINUXCONCEPT Nginx Installation Test You can verify that installed Nginx is working as expected by opening in your browser with your IP (http://your-IP). You will get the browser screen with default Nginx welcome page, as shown below: https://linuxconcept.com/how-to-install-nginx-on-ubuntu-21-04-server/
  • 6. LINUXCONCEPT Install Nginx using Nginx PPA Repository The Ubuntu default software repository is not updating packages regularly, so it often outdated. To install Nginx’s latest version, use Nginx’s official PPA repository. To install Nginx using PPA repository in Ubuntu 21.04, follow below steps: 01. install “software-properties-common” in Ubuntu system # sudo apt install software-properties-common 02. Add Nginx’s PPA repository using following command # sudo add-apt-repository ppa:nginx/stable 03. Update package manager with list and install Nginx using following command: # sudo apt update # sudo apt install nginx 04. After completing the installation of Nginx, check the version of installed Nginx # sudo nginx -v nginx version: nginx/1.17.0 https://linuxconcept.com/how-to-install-nginx-on-ubuntu-21-04-server/
  • 7. LINUXCONCEPT Manage Nginx service with systemctl You can manage Nginx services with the similar command what use to manage other system services. Start the Nginx Service: # sudo systemctl start nginx Stop the Nginx Service: # sudo systemctl stop nginx Restart the Nginx Service: # sudo systemctl restart nginx Reload the Nginx Service: # sudo systemctl reload nginx Enable the Nginx Service to start at boot: # sudo systemctl enable nginx Disable the Nginx Service to not start on boot: # sudo systemctl disable nginx https://linuxconcept.com/how-to-install-nginx-on-ubuntu-21-04-server/
  • 8. LINUXCONCEPT The Nginx configuration files will always remain in the “/etc/nginx/” directory. The main Nginx’s setting files located at “/etc/nginx/nginx.conf.” To keep Nginx configuration is simple by configuring separate files for each site. You can keep as much as you want with a configuration file with a server block. Nginx server block files or site configuration files stored in the “/etc/nginx/sites-available/” directory. To make these files in use on Nginx, link the files in the “/etc/nginx/sites- enable/” directory. To activate any new site configuration, we need to create a symlink of site configuration file available in the “sites- available” directory to the “sites-enabled” directory. To identify the site’s configuration, follow the standard naming conversion for server block files. For example, you have a site testweb.com. It is better to create a file as “/etc/nginx/sites-available/testweb.com.conf” to identify quickly when you have multiple sites configured in the Nginx web server. Nginx configuration file’s structure on Ubuntu https://linuxconcept.com/how-to-install-nginx-on-ubuntu-21-04-server/
  • 9. LINUXCONCEPT /home/<user>/<site-name> /var/www/<site-name> /var/www/html/<site-name> /opt/<site-name> There is no boundry to configure domain document root directory, you can set any location you want. But the most recommended location for web root directory are: Conclusion Congratulation; now you have installed the Nginx Web server on your Ubuntu 21.04 server. Now, you are ready to deploy and run your application using Nginx as a web server or reverse proxy server. https://linuxconcept.com/how-to-install-nginx-on-ubuntu-21-04-server/
  • 10. LINUXCONCEPT THANK YOU You can check our website https://linuxconcept.com for more similar information on Linux or opensource technologies. https://linuxconcept.com/how-to-install-nginx-on-ubuntu-21-04-server/