NGINX is a free, open-source, high-performance HTTP server and reverse proxy, as well as an IMAP/POP3 proxy server. NGINX is known for its high performance, stability, rich feature set, simple configuration, and low resource consumption.
Nginx is available in Ubuntu's default repositories. Update our local package index so that we have access to the most recent package listings. Afterwards, we can install nginx:
$ sudo apt-get update
$ sudo apt-get install nginx
At the end of the installation process, Ubuntu 16.04 starts Nginx. The web server should already be up and running. We can check with command:
$ systemctl status nginx
When you have your server's IP address or domain, enter it into your browser's address bar:
Now that you have your web server up and running, we can go over some basic management commands.
To stop your web server, you can type:
$ sudo systemctl stop nginx
To start the web server when it is stopped, type:
$ sudo systemctl start nginx
To stop and then start the service again, type:
If you are simply making configuration changes, Nginx can often reload without dropping connections. To do this, this command can be used:
$ sudo systemctl restart nginx
$ sudo systemctl reload nginx
By default, Nginx is configured to start automatically when the server boots. If this is not what you want, you can disable this behavior by typing:
$ sudo systemctl disable nginx
To re-enable the service to start up at boot, you can type:
$ sudo systemctl enable nginx
/var/www/html: The actual web content, which by default only consists of the default Nginx page you saw earlier, is served out of the /var/www/html directory.Server Configuration
/etc/nginx: The nginx configuration directory. All of the Nginx configuration files reside here.
/etc/nginx/nginx.conf: The main Nginx configuration file. This can be modified to make changes to the Nginx global configuraiton.
/etc/nginx/sites-available: The directory where per-site "server blocks" can be stored. Nginx will not use the configuration files found in this directory unless they are linked to the sites-enabled directory.
/etc/nginx/sites-enabled/: The directory where enabled per-site "server blocks" are stored. Typically, these are created by linking to configuration files found in the sites-available directory.Server Logs
/var/log/nginx/access.log: Every request to your web server is recorded in this log file.
/var/log/nginx/error.log: Any Nginx errors will be recorded in this log.