Note:-The Uncomplicated Firewall (ufw) is a frontend for iptables and is particularly well-suited for host-based firewalls. ufw provides a framework for managing netfilter, as well as a command-line interface for manipulating the firewall.

Verify the change:

sudo ufw status

Check your Web Server

sudo systemctl status nginx

For your public IP address as seen from another location on the Internet:

sudo apt-get install curl

curl -4 icanhazip.com

When you have your server’s IP address or domain, enter it into your browser’s address bar:

http://server_domain_or_IP

You should see the default Nginx landing page…

Manage the Nginx Process

Some basic management commands.

To stop your web server:

sudo systemctl stop nginx

To start the web server when it is stopped:

sudo systemctl start nginx

To stop and then start the service again:

sudo systemctl restart nginx

If you are simply making configuration changes, Nginx can often reload without dropping connections:

sudo systemctl reload nginx

By default, Nginx is configured to start automatically when the server boots. You can disable:

sudo systemctl disable nginx

To re-enable the service to start up at boot:

sudo systemctl enable nginx

To view the current version of Nginx, do the following:

./nginx -v

To debug issues, view the error.log and access.log files located under /usr/local/nginx/logs

ls /usr/local/nginx/logs/

Important Nginx Files and Directories

Content

/var/www/html: The actual web content (for all the web server), which by default only consists of the default Nginx page you saw earlier, is served out of the /var/www/html directory. This can be changed by altering Nginx configuration files.

Server Configuration

/etc/nginx: The nginx configuration directory. All of the Nginx configuration files inside this directory.