How To Install Nginx on Ubuntu 16.04?

Nginx is one of the popular web servers used on the internet. Ngnix can be used as a web server or a reverse proxy.

  1. Install Nginx
    1. sudo apt-get update
    2. sudo apt-get install nginx
  2. Make changes to Firewall
    1. sudo ufw app list (to list apps)
    2. sudo ufw allow ‘Nginx HTTP’
    3. sudo ufw status
  3. Check the status
    1. systemctl status nginx
  4. Nginx Relates Files and Folders
    1. Web Content Location: /var/www/html
    2. Nginx Configuration File: /etc/nginx/nginx.conf
    3. Access Log: /var/log/nginx/access.log
    4. Error Log: /var/log/nginx/error.log
  5. Managing Nginx
    1. Stop: sudo systemctl stop nginx
    2. Start: sudo systemctl start nginx
    3. Restart: sudo systemctl restart nginx
    4. Reload Config Changes: sudo systemctl reload nginx