Nginx is another most popular web server than Apache HTTP Server. It is used by a large number of popular websites word wide. This web server is highly useful for heavy traffic websites. This tutorial will help you to install Nginx on Debian 8 Jessie using apt-get.
1. Prerequisites
To install Nginx on Debian 8, 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.
ssh root@debian9
2. Install Nginx on Debian 8
The Nginx latest packages are available under default repositories for all Ubuntu’s versions, You can directly install them by running following commands
sudo apt-get update sudo apt-get install nginx
After installation of Nginx service, run below command to check the status of Nginx service.
sudo systemctl status nginx
● 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 Mon 2018-04-30 03:54:27 UTC; 2s ago Docs: man:nginx(8) Process: 5396 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code=exited, status=0/SUCCESS) Process: 5394 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=0/SUCCESS) Main PID: 5398 (nginx) Tasks: 2 (limit: 4915) CGroup: /system.slice/nginx.service ├─5398 nginx: master process /usr/sbin/nginx -g daemon on; master_process on; └─5399 nginx: worker process
3. Configure Firewall
Most probably you are using IPTABLES for Debian system. The following command will allow port 80 (HTTP).
sudo iptables -A INPUT -p tcp -m tcp --dport 80 -j ACCEPT
You can use the same for port 443 (HTTPS). If you somehow used ufw firewall use following:
sudo ufw allow 80/tcp
4. Manage Nginx Service
The systemd users use systemctl commands to manage their Nginx service on Debian 8 Jessie. The below commands will stop, star, and restart nginx service.
sudo systemctl stop nginx sudo systemctl start nginx sudo systemctl restart nginx