Install Nginx 1.14.1 on CentOS 8

Hi, thanks for visiting my tech blog. If you run into any problem while following the steps, do let me know by either commenting on this post or video.

Subscribe https://www.youtube.com/channel/UCIN-BwNnZG0ojE22byWy07A?sub_confirmation=1

Commands

yum install nginx
nginx -v
rpm -qa| grep nginx
systemctl status nginx
systemctl start nginx
systemctl enable nginx
systemctl status nginx
firewall-cmd --permanent --add-service=http
firewall-cmd --permanent --list-all
firewall-cmd --reload
curl -I localhost

[[email protected] ~]# yum install nginx
Last metadata expiration check: 8:48:00 ago on Fri 17 Jul 2020 03:31:19 PM IST.
Dependencies resolved.
=====================================================================================================
Package Arch Version Repository Size
=====================================================================================================
Installing:
nginx x86_64 1:1.14.1-9.module_el8.0.0+184+e34fea82 AppStream 570 k
Installing dependencies:
nginx-all-modules noarch 1:1.14.1-9.module_el8.0.0+184+e34fea82 AppStream 23 k
nginx-filesystem noarch 1:1.14.1-9.module_el8.0.0+184+e34fea82 AppStream 24 k
nginx-mod-http-image-filter x86_64 1:1.14.1-9.module_el8.0.0+184+e34fea82 AppStream 35 k
nginx-mod-http-perl x86_64 1:1.14.1-9.module_el8.0.0+184+e34fea82 AppStream 45 k
nginx-mod-http-xslt-filter x86_64 1:1.14.1-9.module_el8.0.0+184+e34fea82 AppStream 33 k
nginx-mod-mail x86_64 1:1.14.1-9.module_el8.0.0+184+e34fea82 AppStream 64 k
nginx-mod-stream x86_64 1:1.14.1-9.module_el8.0.0+184+e34fea82 AppStream 85 k

Transaction Summary
=====================================================================================================
Install 8 Packages

Total download size: 881 k
Installed size: 2.0 M
Is this ok [y/N]: y
Downloading Packages:
(1/8): nginx-all-modules-1.14.1-9.module_el8.0.0+184+e34fea82.noarch 130 kB/s | 23 kB 00:00
(2/8): nginx-filesystem-1.14.1-9.module_el8.0.0+184+e34fea82.noarch. 129 kB/s | 24 kB 00:00
(3/8): nginx-mod-http-image-filter-1.14.1-9.module_el8.0.0+184+e34fe 667 kB/s | 35 kB 00:00
(4/8): nginx-mod-http-perl-1.14.1-9.module_el8.0.0+184+e34fea82.x86_ 629 kB/s | 45 kB 00:00
(5/8): nginx-mod-http-xslt-filter-1.14.1-9.module_el8.0.0+184+e34fea 642 kB/s | 33 kB 00:00
(6/8): nginx-mod-mail-1.14.1-9.module_el8.0.0+184+e34fea82.x86_64.rp 918 kB/s | 64 kB 00:00
(7/8): nginx-mod-stream-1.14.1-9.module_el8.0.0+184+e34fea82.x86_64. 1.1 MB/s | 85 kB 00:00
(8/8): nginx-1.14.1-9.module_el 35% [==========- ] 301 kB/s | 311 kB 00:01 ETA
[MIRROR] nginx-1.14.1-9.module_el8.0.0+184+e34fea82.x86_64.rpm: Curl error (7): Couldn’t connect to server for http://centos.mirror.snu.edu.in/centos/8.2.2004/AppStream/x86_64/os/Packages/nginx-1.14.1-9.module_el8.0.0+184+e34fea82.x86_64.rpm [Failed to connect to centos.mirror.snu.edu.in port 80: Connection refused]
[MIRROR] nginx-1.14.1-9.module_el8.0.0+184+e34fea82.x86_64.rpm: Status code: 500 for http://mirrors.piconets.webwerks.in/centos-mirror/8.2.2004/AppStream/x86_64/os/Packages/nginx-1.14.1-9.module_el8.0.0+184+e34fea82.x86_64.rpm (IP: 43.240.66.200)
(8/8): nginx-1.14.1-9.module_el8.0.0+184+e34fea82.x86_64.rpm 15 kB/s | 570 kB 00:37
—————————————————————————————————–
Total 23 kB/s | 881 kB 00:38
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Running scriptlet: nginx-filesystem-1:1.14.1-9.module_el8.0.0+184+e34fea82.noarch 1/8
Installing : nginx-filesystem-1:1.14.1-9.module_el8.0.0+184+e34fea82.noarch 1/8
Installing : nginx-mod-http-image-filter-1:1.14.1-9.module_el8.0.0+184+e34fea82.x86_64 2/8
Running scriptlet: nginx-mod-http-image-filter-1:1.14.1-9.module_el8.0.0+184+e34fea82.x86_64 2/8
Installing : nginx-mod-http-perl-1:1.14.1-9.module_el8.0.0+184+e34fea82.x86_64 3/8
Running scriptlet: nginx-mod-http-perl-1:1.14.1-9.module_el8.0.0+184+e34fea82.x86_64 3/8
Installing : nginx-mod-http-xslt-filter-1:1.14.1-9.module_el8.0.0+184+e34fea82.x86_64 4/8
Running scriptlet: nginx-mod-http-xslt-filter-1:1.14.1-9.module_el8.0.0+184+e34fea82.x86_64 4/8
Installing : nginx-mod-mail-1:1.14.1-9.module_el8.0.0+184+e34fea82.x86_64 5/8
Running scriptlet: nginx-mod-mail-1:1.14.1-9.module_el8.0.0+184+e34fea82.x86_64 5/8
Installing : nginx-all-modules-1:1.14.1-9.module_el8.0.0+184+e34fea82.noarch 6/8
Installing : nginx-1:1.14.1-9.module_el8.0.0+184+e34fea82.x86_64 7/8
Running scriptlet: nginx-1:1.14.1-9.module_el8.0.0+184+e34fea82.x86_64 7/8
Installing : nginx-mod-stream-1:1.14.1-9.module_el8.0.0+184+e34fea82.x86_64 8/8
Running scriptlet: nginx-mod-stream-1:1.14.1-9.module_el8.0.0+184+e34fea82.x86_64 8/8
Verifying : nginx-1:1.14.1-9.module_el8.0.0+184+e34fea82.x86_64 1/8
Verifying : nginx-all-modules-1:1.14.1-9.module_el8.0.0+184+e34fea82.noarch 2/8
Verifying : nginx-filesystem-1:1.14.1-9.module_el8.0.0+184+e34fea82.noarch 3/8
Verifying : nginx-mod-http-image-filter-1:1.14.1-9.module_el8.0.0+184+e34fea82.x86_64 4/8
Verifying : nginx-mod-http-perl-1:1.14.1-9.module_el8.0.0+184+e34fea82.x86_64 5/8
Verifying : nginx-mod-http-xslt-filter-1:1.14.1-9.module_el8.0.0+184+e34fea82.x86_64 6/8
Verifying : nginx-mod-mail-1:1.14.1-9.module_el8.0.0+184+e34fea82.x86_64 7/8
Verifying : nginx-mod-stream-1:1.14.1-9.module_el8.0.0+184+e34fea82.x86_64 8/8
Installed products updated.

Installed:
nginx-1:1.14.1-9.module_el8.0.0+184+e34fea82.x86_64
nginx-all-modules-1:1.14.1-9.module_el8.0.0+184+e34fea82.noarch
nginx-filesystem-1:1.14.1-9.module_el8.0.0+184+e34fea82.noarch
nginx-mod-http-image-filter-1:1.14.1-9.module_el8.0.0+184+e34fea82.x86_64
nginx-mod-http-perl-1:1.14.1-9.module_el8.0.0+184+e34fea82.x86_64
nginx-mod-http-xslt-filter-1:1.14.1-9.module_el8.0.0+184+e34fea82.x86_64
nginx-mod-mail-1:1.14.1-9.module_el8.0.0+184+e34fea82.x86_64
nginx-mod-stream-1:1.14.1-9.module_el8.0.0+184+e34fea82.x86_64

Complete!
[[email protected] ~]#
[[email protected] ~]#
[[email protected] ~]# nginx -V
nginx version: nginx/1.14.1
built by gcc 8.2.1 20180905 (Red Hat 8.2.1-3) (GCC)
built with OpenSSL 1.1.1 FIPS 11 Sep 2018 (running with OpenSSL 1.1.1c FIPS 28 May 2019)
TLS SNI support enabled
configure arguments: –prefix=/usr/share/nginx –sbin-path=/usr/sbin/nginx –modules-path=/usr/lib64/nginx/modules –conf-path=/etc/nginx/nginx.conf –error-log-path=/var/log/nginx/error.log –http-log-path=/var/log/nginx/access.log –http-client-body-temp-path=/var/lib/nginx/tmp/client_body –http-proxy-temp-path=/var/lib/nginx/tmp/proxy –http-fastcgi-temp-path=/var/lib/nginx/tmp/fastcgi –http-uwsgi-temp-path=/var/lib/nginx/tmp/uwsgi –http-scgi-temp-path=/var/lib/nginx/tmp/scgi –pid-path=/run/nginx.pid –lock-path=/run/lock/subsys/nginx –user=nginx –group=nginx –with-file-aio –with-ipv6 –with-http_ssl_module –with-http_v2_module –with-http_realip_module –with-http_addition_module –with-http_xslt_module=dynamic –with-http_image_filter_module=dynamic –with-http_sub_module –with-http_dav_module –with-http_flv_module –with-http_mp4_module –with-http_gunzip_module –with-http_gzip_static_module –with-http_random_index_module –with-http_secure_link_module –with-http_degradation_module –with-http_slice_module –with-http_stub_status_module –with-http_perl_module=dynamic –with-http_auth_request_module –with-mail=dynamic –with-mail_ssl_module –with-pcre –with-pcre-jit –with-stream=dynamic –with-stream_ssl_module –with-debug –with-cc-opt=’-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection’ –with-ld-opt=’-Wl,-z,relro -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -Wl,-E’
[[email protected] ~]#
[[email protected] ~]# nginx -v
nginx version: nginx/1.14.1
[[email protected] ~]#
[[email protected] ~]# rpm -qa| grep nginx
nginx-1.14.1-9.module_el8.0.0+184+e34fea82.x86_64
nginx-mod-http-xslt-filter-1.14.1-9.module_el8.0.0+184+e34fea82.x86_64
nginx-filesystem-1.14.1-9.module_el8.0.0+184+e34fea82.noarch
nginx-mod-mail-1.14.1-9.module_el8.0.0+184+e34fea82.x86_64
nginx-mod-http-image-filter-1.14.1-9.module_el8.0.0+184+e34fea82.x86_64
nginx-all-modules-1.14.1-9.module_el8.0.0+184+e34fea82.noarch
nginx-mod-http-perl-1.14.1-9.module_el8.0.0+184+e34fea82.x86_64
nginx-mod-stream-1.14.1-9.module_el8.0.0+184+e34fea82.x86_64
[[email protected] ~]#
[[email protected] ~]#
[[email protected] ~]# systemctl status nginx
● nginx.service – The nginx HTTP and reverse proxy server
Loaded: loaded (/usr/lib/systemd/system/nginx.service; disabled; vendor preset: disabled)
Active: inactive (dead)

Jul 18 00:20:01 server.the-d2.com systemd[1]: nginx.service: Unit cannot be reloaded because it is i>
[[email protected] ~]#
[[email protected] ~]# systemctl start nginx
[[email protected] ~]#
[[email protected] ~]# systemctl enable nginx
Created symlink /etc/systemd/system/multi-user.target.wants/nginx.service → /usr/lib/systemd/system/nginx.service.
[[email protected] ~]#
[[email protected] ~]# systemctl status nginx
● nginx.service – The nginx HTTP and reverse proxy server
Loaded: loaded (/usr/lib/systemd/system/nginx.service; enabled; vendor preset: disabled)
Active: active (running) since Sat 2020-07-18 00:20:33 IST; 7s ago
Main PID: 3506 (nginx)
Tasks: 2 (limit: 21928)
Memory: 6.8M
CGroup: /system.slice/nginx.service
├─3506 nginx: master process /usr/sbin/nginx
└─3507 nginx: worker process

Jul 18 00:20:33 server.the-d2.com systemd[1]: Starting The nginx HTTP and reverse proxy server…
Jul 18 00:20:33 server.the-d2.com nginx[3502]: nginx: the configuration file /etc/nginx/nginx.conf s>
Jul 18 00:20:33 server.the-d2.com nginx[3502]: nginx: configuration file /etc/nginx/nginx.conf test >
Jul 18 00:20:33 server.the-d2.com systemd[1]: nginx.service: Failed to parse PID from file /run/ngin>
Jul 18 00:20:33 server.the-d2.com systemd[1]: Started The nginx HTTP and reverse proxy server.
[[email protected] ~]#
[[email protected] ~]# firewall-cmd –permanent –add-service=http
success
[[email protected] ~]# firewall-cmd –permanent –list-all
public
target: default
icmp-block-inversion: no
interfaces:
sources:
services: cockpit dhcpv6-client http ssh
ports:
protocols:
masquerade: no
forward-ports:
source-ports:
icmp-blocks:
rich rules:

[[email protected] ~]#
[[email protected] ~]# getenforce
Enforcing
[[email protected] ~]#
[[email protected] ~]# setenforce 0
[[email protected] ~]#
[[email protected] ~]# firewall-cmd –reload
success
[[email protected] ~]# ip a | grep inet
inet 127.0.0.1/8 scope host lo
inet6 ::1/128 scope host
inet 192.168.126.129/24 brd 192.168.126.255 scope global dynamic noprefixroute ens33
inet6 fe80::76c1:6bd7:34dc:f144/64 scope link noprefixroute
inet 192.168.122.1/24 brd 192.168.122.255 scope global virbr0
[[email protected] ~]#
[[email protected] ~]#
[[email protected] ~]# curl -I 192.168.126.129
HTTP/1.1 200 OK
Server: nginx/1.14.1
Date: Fri, 17 Jul 2020 18:51:35 GMT
Content-Type: text/html
Content-Length: 4057
Last-Modified: Mon, 07 Oct 2019 21:16:24 GMT
Connection: keep-alive
ETag: “5d9bab28-fd9”
Accept-Ranges: bytes

Leave a Reply