Nginx - Installation and configuration steps Ubuntu 16.04

NGINX -
NGINX is a free, open-source, high-performance HTTP server and reverses 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 one of a handful of servers written to address the C10K problem



NGINX doesn’t rely on threads to handle requests. Instead, it uses a much more scalable event-driven (asynchronous) architecture. This architecture uses small, but more importantly, predictable amounts of memory under load. Even if you don’t expect to handle thousands of simultaneous requests, you can still benefit from NGINX’s high-performance and small memory footprint. NGINX scales in all directions: from the smallest VPS all the way up to large clusters of servers.

Step 1- Install Nginx
NGINX is available in Ubuntu's default repositories, So the installation is easy.
Run the below command to install Nginx.
$ sudo apt install nginx
Step 2- Check service status
After NGINX installation check status of nginx server using the command below
$ sudo systemctl status nginx.service
NGINX service is up and running.
Step 3- Enable Nginx service to start at system boot.
By-Default Nginx service works until the server is up running once your machine gets reboot your Nginx service will not come online. To start service at boot time hit below command.
sudo systemctl enable nginx.service
Now you Nginx server is enabled and will start auto at system boot.
Step 4- Test Nginx server installation-
Nginx installation completed, let's check installation by hitting server IP address-



Step 5-  Nginx important configuration files-
  • /etc/nginx/site-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 (see below). Typically, all server block configuration is done in this directory and then enabled by linking to the other directory.
  • /etc/nginx/site-enable/: 
    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.
  • /etc/ngnix/snippets/: 
    This directory contains configuration fragments that can be included elsewhere in the Nginx configuration. Potentially repeatable configuration segments are good candidates for refactoring into snippets.
Step 6- Nginx Log location-
  • /var/log/nginx/access.log: 
Every request to your web server is recorded in this log file unless Nginx is configured to do otherwise.
  • /var/log/nginx/error.log: 
Any Nginx errors will be recorded in this log.

NGINX installation completed successfully. 

No comments:

Post a Comment