Also, enable the OpenSSH profile if it's not active, as shown. This will allow us to continue accessing our Nginx machine over SSH:
sudo ufw allow 'OpenSSH'
You won't be able to log in to your Nginx machine if OpenSSH is disabled.
Verify the changes using the following command. You should see Nginx Full and OpenSSH as allowed:
sudo ufw status
You should see the following output:
Status: active
To Action From
-- ------ ----
OpenSSH ALLOW Anywhere
Nginx Full ALLOW Anywhere
OpenSSH (v6) ALLOW Anywhere (v6)
Nginx Full (v6) ALLOW Anywhere (v6)
Check if the Nginx service is running using the systemctl command:
systemctl status nginx
You should see the following output:
● 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 Thu 2017-07-20 18:44:33 UTC; 45min ago
Main PID: 2619 (nginx)
Tasks: 2
Memory: 5.1M
CPU: 13ms
CGroup: /system.slice/nginx.service
├─2619 nginx: master process /usr/sbin/nginx -g daemon on; master_process on
└─2622 nginx: worker process
From the previous output, you can see that our Nginx service is running fine. Now try to access it using the browser. First, get the IP address of your machine using the ip route command:
ip route
You should see the following output:
default via 10.0.2.2 dev enp0s3 10.0.2.0/24 dev enp0s3 proto kernel scope link src 10.0.2.15 192.168.56.0/24 dev enp0s8 proto kernel scope link src 192.168.56.104
Now access the Nginx home page using http://<IP Address>:80. You should see something similar to the following screenshot: