Nginx is an open source software for web serving ( nginx on ubuntu 20.04 ) like Apache. You can check how to config apache in here . It uses a single-threaded architecture and is designed for maximum performance and stability. So it is more efficient than Apache if configured correctly. In addition to HTTP server capabilities. NGINX can also act as a proxy server for email (POP3, SMTP, …), a load balancer and reverse proxy for HTTP, TCP and UDP servers.
Step 1: Install Nginx on ubuntu 20.04
Since Nginx is available in the Ubuntu repositories, you can directly install Nginx using the apt package management and installation system. First, proceed to update the packages in the system:
sudo apt install -y update
Install Nginx for your Ubuntu server:
sudo apt install -y nginx
Check Nginx version:
sudo nginx -v
nginx version: nginx/1.17.10 (Ubuntu)
Allow Nginx to start on system:
sudo systemctl enable nginx
Start and check the status of the Nginx service:
systemctl start nginx
systemctl status nginx
● 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 2020-04-27 09:34:14 +07; 5min ago
Docs: man:nginx(8)
Main PID: 7569 (nginx)
Tasks: 5 (limit: 2318)
Memory: 6.0M
CGroup: /system.slice/nginx.service
├─7569 nginx: master process /usr/sbin/nginx -g daemon on; master_process on;
├─7570 nginx: worker process
├─7571 nginx: worker process
├─7572 nginx: worker process
└─7573 nginx: worker process
Thg 4 27 09:34:14 Ubuntulab systemd[1]: Starting A high performance web server and a reverse proxy server...
Thg 4 27 09:34:14 Ubuntulab systemd[1]: Started A high performance web server and a reverse proxy server.
Step 2: Configure the firewall
Use ufw to know how to use firewall configuration for Nginx :
sudo ufw app list
Available applications:
CUPS
Nginx Full
Nginx HTTP
Nginx HTTPS
OpenSSH
We see that for nginx, there are 3 possible configurations to configure for nginx. But currently I do not have a configuration to use SSL for the website, so I only allow traffic to go through port 80.
Enable the above using the following command:
sudo ufw allow 'Nginx HTTP'
Then test the change again with the following command:
sudo ufw status
Step 3: Check the website
To test the website, open a browser and enter the ip address of the Nginx server.
However, If you have any questions or comments, feel free about configure nginx on ubuntu 20.04 to contact me here or comment below the post
So Thank you for your interest in my articles
Wish you a good day