Installing Nginx on Linux

ServerNginx
Installing Nginx on Linux - Banner

Nginx (pronounced "engine-ex") is an open source web server created by Igor Sysoev. High performance, low memory use, thanks to an event-driven architecture that handles thousands of requests at once. It also ships with a reverse proxy, an HTTP cache, and a load balancer.

Before installing, there are two versions:

  • Mainline: has all of Nginx's latest features and fixes, but may contain new bugs.
  • Stable: doesn't have all the latest features, but does include the critical bug fixes.

In production, use the stable version, which is the one shown below.

Installing Nginx on Ubuntu and Debian

Update the repository:

sudo apt update

Install the nginx package:

sudo apt install nginx

Check the installation:

sudo nginx -v
nginx version: nginx/1.18.0

Check that Nginx is running:

curl -I 127.0.0.1
HTTP/1.1 200 OK
Server: nginx/1.18.0

Installing Nginx on CentOS

Install the EPEL repository:

sudo yum install epel-release

Update the repository:

sudo yum update

Install the nginx package:

sudo yum install nginx

Check the installation:

sudo nginx -v
nginx version: nginx/1.18.0

Check that Nginx is running:

curl -I 127.0.0.1
HTTP/1.1 200 OK
Server: nginx/1.18.0

See here for installing Nginx on other Linux distributions.