Javatpoint Logo
Javatpoint Logo

How to install NGINX on Ubuntu 16.04 LTS?

Introduction

Nginx is an open source HTTP web server. It was created by Igor Sysoev and released on 2004. we can use it to deploy web applications.

It is a web server that can be used as an HTTP cache, mail proxy, load balancer, and reverse proxy. It was published upon the terms of the 2-clause BSD license. A bigger web server fraction utilizes Nginx, frequently as the load balancer. In 2011, the same name company was founded to offer NGINX Plus paid and support software. The company was inherited by F5, Inc. for 670 million dollars in March 2019.

History of Nginx

Igor Sysoev started Nginx development in 2002. Nginx was originally designed to resolve the C10k issue and to fill the requirements of two or more websites, such as the Rambler portal and search engine, for which Nginx was providing 500 million requests/day by September 2008. Nginx Inc. was detected in July 2011 by Maxim Konovalov and Igor Sysoev to offer commercial support and products for the software.

The business principal place of the company is California, San Francisco, while integrated into the British Virgin Islands legally. Nginx Inc. increased by 3 million dollars from the venture fund of Michael Dell, MSD Capital, Runa Capital, and BV Capital in October 2011.

Features of Nginx

Nginx is simple to configure to act as the proxy server or provide static web content. Also, Nginx can be used to provide dynamic content over the network with FastCGI, script handlers of SCGI, Phusion Passenger modules or WSGI application servers, and it can act as an application load balancer.

Nginx utilizes an asynchronous event-driven method instead of threads to manage requests. The latest event-driven architecture of Nginx can offer predictable performance upon high loads.

  • Web server and HTTP proxy aspects
    • Capability to manage 10000+ simultaneous connections using a low memory footprint
    • Managing auto-indexing, index files, and static files
    • Reverse proxy using caching
    • SSL/TSL with OCSP and SNI stapling support by OpenSSL
    • Load balancing using in-band health checks
    • SCGI, uWSGI, and FastCGI support using caching
    • Supports gRPC since March 2018, the 1.13.10 version
    • IPv6 compatible
    • IP address and name-based virtual servers
    • WebSockets since the 1.3.13 version, including doing WebSocket application load balancing and performing as a reverse proxy.
    • HTTP/1.1 Upgrade supports HTTP/2 protocol
    • URL redirection and rewriting
  • Mail proxy aspects
    • Needs authentication with an outside HTTP server or via an authentication script
    • IMAP, POP3, and SMTP proxy
    • Supports STARTTLS
    • Supports TLS/SSL

Other aspects include upgrading the configuration and executable without the loss of client connection and the module-based architecture using both third-party and core module support. Nginx paid Plus product contains extra features, including access to a distributed metrics suite for performance monitoring and excellent load balancing.

Difference between Nginx Plus and Nginx

Two versions of Nginx are available, including Nginx Plus and Nginx Open Source. The Nginx Open Source version is open-source and free software.

Nginx Plus is disposed of as a subscription model. It provides aspects to Nginx Open Source, including active health checks, Active-Active HA using config sync, WAF (Web Application Firewall) dynamic module, key-value stores with Nginx Plus API, on-the-fly using zero downtime upgrades upstream configurations, Key-Value Store, Dynatrace Relic plug-in, Datalog, AppDynamic, Cache Purging API, DNS-service-discovery integration, and cookies-based session persistence.

Nginx vs Apache

Nginx was specified with the explicit purpose of surpassing the Apache Web server. Delivering static files out-of-the-box, Nginx utilizes lesser memory if compared to Apache and can manage hardly four times as various requests/second. Although, this performance boost provides a decreased flexibility cost, including the capability to override the access settings of the entire system on a per-file basis (Nginx doesn't include such an aspect built-in, while Apache accomplishes it using a .htaccess file).

Including third-party modules in Nginx formerly needed recompiling the software with the statically linked modules from the source. Partially, it was overcome in the 1.9.11 version in February 2016, with dynamic module loading. Although the modules must be collected at a similar time as Nginx, and not every module is compatible with the system, a few need the earlier static linking procedure.

Nginx Unit

It is a free web software server published by NGINX, Inc. in 2017 to target microservice multi-language-based applications. The starting release supported software specified in Python, PHP, and Go. By the 1.11.0 version, this support was increased to Ruby, Perl, Node.js, and Java applications. Several features include load balancing, request routing, and dynamic configuration.

Prerequisites

  • Ubuntu
  • Terminal sudo login

Nginx Installation

Installation process is pretty easy, it requires just single line of command. The following command is used for installation.


Software NGINX 1

After installation, we can access it using browser by typing localhost and it will display the following output.

Software NGINX 2

Well, we have installed it successfully on the Ubuntu operating system.

Manage Nginx Server

The following commands are used to manage server tasks like stop, start etc.

Start Nginx

Use following command to start nginx server.

Stop Nginx

Use following command to stop nginx server.

Restart Nginx

Use following command to restart nginx server.

Status of Nginx

Use following command to check status of nginx server.


Software NGINX 3

Reload Nginx

If we make changes to the server configuration, simply reload the nginx without dropping connection. Use the following command to reload the server.

Disable Nginx at Booting Time

By default, Nginx is enable at booting time and starts automatically. If we want to disable it, use the following command.


Software NGINX 4

Enable Nginx at Booting Time

If we want to start Nginx server automatically at boot time, use the following command.


Software NGINX 5

Extra Info

/var/www/html/ is a server root directory.

/etc/nginx/ is a configuration directory.

/var/log/nginx/access.log is a server log file that contains records of all request.

/var/log/nginx/error.log is a server error log file that contains error records.







Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA