NGINX / Server Setup

How to install nginx on RHEL 7 / CentOS 7 properly

by , , revisited on

We have by far the largest RPM repository with NGINX module packages and VMODs for Varnish. If you want to install NGINX, Varnish, and lots of useful performance/security software with smooth yum upgrades for production use, this is the repository for you.
Active subscription is required.

The Internet is full of wrong advice everywhere. Unfortunately, the first results in Google tend to lead you to the worst advice of compiling NGINX from source to avail of features like ALPN or integrating some modules. See my post on [where the compilation is wrong][] to realize why compilation should be absolutely avoided.

Follow these instructions on how to install the latest stable NGINX web server in RHEL 7 / CentOS 7 server.

Step 1. Prepare your system

First things first. You have to upgrade your RHEL / CentOS 7 to the latest release:

sudo yum -y upgrade

Next, decide on the repository to fetch NGINX from:

Step 2. Setup RPM repository

Our CDN powered repository builds on exact same binaries released by official website.

sudo yum -y install

Step 3. Install NGINX

Option 1. Install latest stable NGINX

sudo yum install nginx

Option 2. Install latest mainline NGINX

The mainline NGINX is in fact, also stable for production. However, it receives more updates with new features, whereas the stable branch is updated less frequently.
To install the mainline NGINX, enable extra repository and proceed as usual:

sudo yum -y install yum-utils
sudo yum-config-manager --enable getpagespeed-extras-mainline 
sudo yum install nginx


Now we are ready to run NGINX:

sudo systemctl enable --now nginx

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: