Nginx | Lightweight and High Performance Web Server

NGINX Free Web Server Solution Stack

Open source Web Server & Reverse Proxy Solution

Other then being a web server, NGINX also serve as a reverse proxy, load balancer and HTTP cache. Its known for high scalability, performance and security.

 

NGINX web server supports all the components of the modern Web including WebSocket, HTTP/2, and streaming of multiple video formats. It started out as a web server but now, it has developed to also function as a proxy server for email (IMAP, POP3, and SMTP). It also work as reverse proxy and load balancer for HTTP, TCP, and UDP servers. NGINX consistently beats Apache and other servers if measured on web server performance.

The software structure is asynchronous and event-driven. It enables the processing of multiple requests at the same time. NGINX web server is highly scalable, so its service grows along with its clients’ traffic. Nginx uses much less memory than Apache. It can handle roughly four times as many requests per second. NGINX is one of the most reliable servers for speed and scalability. Due to which, many high traffic websites have been using NGINX’s service. Some examples include Google, Netflix, Adobe, Cloudflare and WordPress.

Supported Platforms include:

  • Linux
  • Solaris
  • macOS
  • Windows

System Requirements

  • Ubuntu 18.04 Operating system
  • Non-root user with sudo privileges configured on your server

Features

  • Users Cahing to accelerate reverse proxying
  • Load balancing and fault tolerance
  • Accelerated support with caching of FastCGI, uwsgi, SCGI, and memcached servers
  • Modular architecture
  • Supports SSL and TLS SNI
  • Support for HTTP/2
  • Name-based and IP-based virtual servers
  • Supports keep-alive and pipelined connections
  • Also supports URI changing using regular expressions
  • It also alllow validation of HTTP referer
  • It support FLV and MP4 streaming
  • Embedded Perl
  • User redirection to IMAP or POP3 server using an external HTTP authentication server
  • SSL support
  • STARTTLS and STLS support
  • Generic proxying of TCP and UDP
  • SSL and TLS SNI support for TCP
  • Load balancing and fault tolerance
  • Access control based on client address
  • IP-based geolocation

Installation Instructions

Install NGINX from Ubuntu’s default repositories using apt command

sudo apt update
sudo apt install nginx

Next you need to adjust the firewall

sudo ufw app list

Then it will show available applications

  • NGINX Full
  • NGINX HTTP
  • OpenSSH
  • NGINX HTTPS

It is recommended to enable the most restrictive profile. Since the SSL is not configured, allow non SSL traffic for now

sudo ufw allow 'Nginx HTTP'

Now verify the status

sudo ufw status

Next we need to verify installation status

systemctl status nginx

Use server’s IP address to to access the default NGINX landing page. Here are some methods to get server’s IP address

ip addr show eth0 | grep inet | awk '{ print $2; }' | sed 's/\/.*$//'

Another way to get server’s public IP address is

curl -4 icanhazip.com

When you have your server’s IP address, enter it into your browser’s address bar:

http://your_server_ip

That’s it. NGINX is installed successfully.

Some Helpful Commands

Stop web server

sudo systemctl stop nginx

Start web server

sudo systemctl start nginx

Stop and then start the server

sudo systemctl restart nginx

Reload web server

sudo systemctl reload nginx

Disable and Enable NGINX

sudo systemctl disable nginx

To re-enable the service to start up at boot, you can type:

sudo systemctl enable nginx