fbpx

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][https://www.getpagespeed.com/server-setup/where-compilation-went-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 nginx.org website.

sudo yum -y install https://extras.getpagespeed.com/release-latest.rpm

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

Run NGINX

Now we are ready to run NGINX:

sudo systemctl enable --now nginx

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

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