1. Prerequisites

To install Nginx on Debian 9, you must have root or sudo privileged user access to your system. For the remote systems can use ssh command or putty for Windows user to login.

2. Install Nginx on Debian 9

The Nginx latest packages are available under default repositories for all Ubuntu’s versions, You can directly install them by running following commands After installation of Nginx service, run below command to check the status of Nginx service.

3. Configure Firewall

Most probably you are using IPTABLES for Debian system. The following command will allow port 80 (HTTP). You can use the same for port 443 (HTTPS). If you somehow used ufw firewall use following:

4. Manage Nginx Service

The systemd users use systemctl commands to manage their Nginx service on Debian 9 stretch. The below commands will stop, star, and restart nginx service.