How to Install Nginx server on Ubuntu 16.04

Posted by Vasilis on May 17, 2018

Install Nginx

sudo apt-get update
sudo apt-get install nginx

After installing, the web server should already be running.

Check the status

systemctl status nginx

Stop the web server

sudo systemctl stop nginx

Start the web server

sudo systemctl start nginx

After making configuration changes you can just reload the web server

sudo systemctl reload nginx

To disable Nginx starting automatically when your servers boots

sudo systemctl disable nginx

To enable again autostart

sudo systemctl enable nginx

Files and directories

  • /var/www/html/ The public web content, here shall be the files of your default web app
  • /etc/nginx//nginx.conf the main Nginx configuration file
  • /etc/nginx/sites-available/ The server block configuration is done in this directory, and then enabled by linking to the sites-enabled/ directory

 

More info 
https://www.digitalocean.com/community/tutorials/how-to-install-nginx-on-ubuntu-16-04