Nginx 1.12 on CentOS/RHEL 7.4 via Yum

Nginx 1.12.1, released 11th July 2017, has been added as a package on the Webtatic EL7 yum repository for CentOS/RHEL 7.4

LNMP (Linux Nginx MySQL PHP) is an alternative web-stack to LAMP (Linux Apache MySQL PHP), with Nginx being better suited to serving static files, due to being able to handle many more simultaneous connections with a lower process count and memory footprint.

Source - Issues

In addition to Nginx 1.12, the packages include:

  • SPDY 3.1 based on Cloudflare’s patches to continue support for older browsers
  • headers_more and pagespeed dynamic modules (optionally installable in addition to the core modules)

To install, first you must add the Webtatic EL yum repository information corresponding to your CentOS/RHEL version to yum:

CentOS/RHEL 7.x:

rpm -Uvh
rpm -Uvh

Now you can install Nginx 1.8 by doing:

yum install nginx18

The nginx1w package will follow all bugfix and minor releases for Nginx 1.x.y beginning with 1.10.3.

The configuration for Nginx can be found in /etc/nginx/.

Unless you know what you are doing, it is risky upgrading an existing system. It’s much safer to do this by provisioning a separate server to perform the upgrade as a fresh install instead.

If you know what you are doing, you can upgrade Nginx by:

yum install yum-plugin-replace
yum replace nginx18 --replace-with=nginx1w
<p>systemctl restart nginx

It will likely give you a message “WARNING: Unable to resolve all providers …“. This is normal, and you can continue by tying “y“. You will be given a chance to see what packages will be installed and removed before again being given a chance to confirm.

If this doesn’t work, then you could use yum shell instead:

yum shell
remove nginx18
install nginx1w
systemctl restart nginx

Static modules

These are modules that come built into the nginx binary based on Webtatic’s compilation scripts:

  • ngx_http_spdy_module (this is based on Cloudflare’s patches to continue SPDY support)
  • ngx_http_ssl_module
  • ngx_http_v2_module
  • ngx_http_realip_module
  • ngx_http_addition_module
  • ngx_http_auth_request_module
  • ngx_http_sub_module
  • ngx_http_dav_module
  • ngx_http_flv_module
  • ngx_http_mp4_module
  • ngx_http_gunzip_module
  • ngx_http_gzip_static_module
  • ngx_http_random_index_module
  • ngx_http_secure_link_module
  • ngx_http_degradation_module
  • ngx_http_stub_status_module
  • ngx_http_slice_module

Dynamic modules

Nginx 1.9 introduced the ability to compile dynamic modules, which are dynamically linked in at runtime, rather than static modules, which are compiled into the nginx binary.

This allows for Nginx to run with a minimal core set of modules, and gives the freedom for server admins to add additional pre-compiled modules to Nginx without having to recompile the core.

The following dynamic modules are available (some of which used to be static modules):

  • ngx_headers_more (installable via: yum install nginx1w-module-headers-more)
  • ngx_http_geoip_module (installable via: yum install nginx1w-module-http-geoip)
  • ngx_http_image_filter_module (installable via: yum install nginx1w-module-http-image-filter)
  • ngx_http_perl_module (installable via: yum install nginx1w-module-http-perl)
  • ngx_http_xslt_module (installable via: yum install nginx1w-module-http-xslt)
  • ngxmail*_module (installable via: yum install nginx1w-module-mail)
  • ngx_pagespeed (installable via: yum install nginx1w-module-pagespeed)
  • ngxstreams*_module (installable via: yum install nginx1w-module-streams)