Installation of Nginx will be done in three main steps:
- Installing Nginx.
- Setup firewall.
- Restart Nginx.
- Check Nginx status.
Installing Nginx.
Run the following commands:
sudo apt update
sudo apt install nginx
Setup firewall.
Add the following rules:
sudo ufw allow 'Nginx HTTP'
sudo ufw allow 'Nginx HTTPS'
Run Restart nginx
Run the following command to to restart the nginx:
sudo systemctl restart nginx
Check Nginx status.
Run the following command to check the status:
systemctl status nginx
Will give you the response like this with green status:
nginx.service - A high performance web server and a reverse proxy server
Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor prese>
Active: active (running) since Sat 2022-04-16 09:45:29 UTC; 1min 31s ago
Docs: man:nginx(8)
Process: 54690 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_pr>
Process: 54691 ExecStart=/usr/sbin/nginx -g daemon on; master_process on;>
Main PID: 54693 (nginx)
Tasks: 3 (limit: 9524)
Memory: 3.0M
CGroup: /system.slice/nginx.service
├─54693 nginx: master process /usr/sbin/nginx -g daemon on; mast>
├─54694 nginx: worker process
└─54695 nginx: worker process