How to install Nginx on Ubuntu 20.04

Xuemeng Technology

This article was first published in: https://www.itcoder.tech/posts/how-to-install-nginx-on-ubuntu-20-04/

Nginx pronounced "engine x" is an open source software, high-performance HTTP and reverse proxy server, used to process some large-scale websites on the Internet. It can be used as an independent web server, [load balancing] (https://cloud.tencent.com/product/clb?from=10680), content caching and reverse proxy server for HTTP and non-HTTP.

Compared with Apache, Nginx can handle a large number of concurrent connections, and each connection takes up a small amount of memory.

This article describes how to install and manage Nginx on Ubuntu 20.04.

1. Prerequisites##

Before continuing, make sure to log in as a sudo user, and you cannot run Apache or other processes on port 80 and port 443.

Two, install Nginx

Nginx is available in the default Ubuntu source repository. To install it, run the following command:

sudo apt update
sudo apt install nginx

Once the installation is complete, Nginx will be started automatically. You can run the following command to verify it:

sudo systemctl status nginx

The output is similar to the following:

● 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 Sat 2020-05-0220:25:43 UTC; 13s ago
...

Three, configure firewall##

Now that you have installed and running Nginx on your server, you need to make sure that your firewall is configured to allow traffic to pass through HTTP (80) and HTTPS (443) ports. Assuming you are using UFW, what you can do is to enable the'Nginx Full' profile, which contains these two ports:

sudo ufw allow 'Nginx Full'

To verify the status, enter:

sudo ufw status

The output will look like this:

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)

Four, test installation##

To test your new Nginx installation, open http://YOUR_IP in your browser, and you should see the default Nginx loading page, like the following:

Five, Nginx configuration file structure and best practices##

Six, summary##

We have shown you how to install Nginx on Ubuntu 20.04.

You can start deploying your application and use Nginx as a network or proxy server.

If you have any questions, please contact us in the following ways:

WeChat: sn0wdr1am86

WeChat group: add the above WeChat, remark the WeChat group

QQ: 3217680847

QQ Group: 82695646

Recommended Posts

How to install Nginx on Ubuntu 20.04
How to install Nginx on Ubuntu 20.04
How to install Nginx on Ubuntu 16.04
How to install Ruby on Ubuntu 20.04
How to install Memcached on Ubuntu 20.04
How to install Java on Ubuntu 20.04
How to install MySQL on Ubuntu 20.04
How to install VirtualBox on Ubuntu 20.04
How to install Elasticsearch on Ubuntu 20.04
How to install Protobuf 3 on Ubuntu
How to install Apache on Ubuntu 20.04
How to install Git on Ubuntu 20.04
How to install Node.js on Ubuntu 16.04
How to install MySQL on Ubuntu 20.04
How to install Vagrant on Ubuntu 20.04
How to install Bacula-Web on Ubuntu 14.04
How to install PostgreSQL on Ubuntu 16.04
How to install Git on Ubuntu 20.04
How to install Anaconda3 on Ubuntu 18.04
How to install Memcached on Ubuntu 18.04
How to install Jenkins on Ubuntu 16.04
How to install MemSQL on Ubuntu 14.04
How to install Nginx on CentOS 8
How to install Go on Ubuntu 20.04
How to install MongoDB on Ubuntu 16.04
How to install Mailpile on Ubuntu 14.04
How to install PrestaShop on Ubuntu 16.04
How to install Skype on Ubuntu 20.04
How to install Jenkins on Ubuntu 20.04
How to install Python 3.8 on Ubuntu 18.04
How to install KVM on Ubuntu 18.04
How to install KVM on Ubuntu 20.04
How to install opencv3.0.0 on ubuntu14.04
How to install Anaconda on Ubuntu 20.04
How to install Prometheus on Ubuntu 16.04
How to install Jenkins on Ubuntu 18.04
How to install Apache on Ubuntu 20.04
How to install R on Ubuntu 20.04
How to install Moodle on Ubuntu 16.04
How to install Solr 5.2.1 on Ubuntu 14.04
How to install Teamviewer on Ubuntu 16.04
How to secure Nginx on Ubuntu 14.04
How to install MariaDB on Ubuntu 20.04
How to install Mono on Ubuntu 20.04
How to install Go on Ubuntu 20.04
How to install Zoom on Ubuntu 20.04
How to install OpenCV on Ubuntu 20.04
How to install Spotify on Ubuntu 20.04
How to install Postman on Ubuntu 18.04
How to install Go 1.6 on Ubuntu 16.04
How to install Go on Ubuntu 18.04
How to install MySQL on Ubuntu 14.04
How to install PostgreSQL on Ubuntu 20.04
How to install VLC on Ubuntu 18.04
How to install TeamViewer on Ubuntu 20.04
How to install Webmin on Ubuntu 20.04
How to install Docker Compose on Ubuntu 18.04
How to install Ubuntu on Raspberry Pi
How to install Bacula Server on Ubuntu 14.04
How to install MySQL on Ubuntu 18.04 (linux)
How to install Ubuntu 19.10 on Raspberry Pi 4