Installing and configuring nginx

To install nginx, you need to execute the following command:

sudo apt-get update
sudo apt-get install nginx

After you have installed nginx, then you can start the configuration:

  1. We need to adjust the firewall to allow the traffic for port 80. To list the available application configurations, you need to run the following command:
sudo ufw app list
Available applications:
Nginx Full
Nginx HTTP
Nginx HTTPS
OpenSSH
  1. Nginx Full means that it will allow the traffic from port 80 (HTTP) and port 443 (HTTPS). We haven't configured any domain with SSL, so, for now, we should restrict the traffic to send the traffic just through port 80 (HTTP):
sudo ufw allow 'Nginx HTTP'
Rules updated
Rules updated (v6)

If you try to access the droplet IP, you should see nginx working:

  1. You can manage the nginx process with these commands:
Start server: sudo systemctl start nginx
Stop server: sudo systemctl stop nginx
Restart server: sudo systemctl restart nginx
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.129.247.196