How to Install Nginx 1.17.3 v from Source Code on CentOS 7.6
- 01:39 yum groupinstall "Development Tools" -y
- 01:52 wget https://nginx.org/download/nginx-1.17.3.tar.gz
- 02:05 wget https://ftp.pcre.org/pub/pcre/pcre-8.43.tar.gz
- 02:21 wget https://www.zlib.net/zlib-1.2.11.tar.xz
- 02:29 wget https://github.com/openssl/openssl/archive/OpenSSL_1_1_1-stable.zip
- 03:15 yum install -y perl perl-devel perl-ExtUtils-Embed libxslt libxslt-devel libxml2 libxml2-devel gd gd-devel GeoIP GeoIP-devel -y
- 04:17 cp /root/nginx-1.17.3/man/nginx.8 /usr/share/man/man8
- 04:52 ./configure --prefix=/etc/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 --pid-path=/var
- 05:10 make
- 05:13 make install
- 05:31 ln -s /usr/share/nginx/modules /etc/nginx/modules
- 05:54 useradd --system --home /var/cache/nginx --shell /sbin/nologin --comment "nginx user" --user-group nginx
- 06:01 nginx -t
- 06:20 vim /etc/systemd/system/nginx.service
- 07:05 systemctl status nginx
Installation of Nginx 1.17.3 V On CentOS 7.6 Using Source Code
Mandatory Requirements:
GCC OpenSSL Zlib Pcre Perl LibGD Libxml2 Libxslt
Dependency Download Links:
Nginx 1.17.3 enter link description here
PCRE 8.4.3 enter link description here
ZLib 1.2.11 enter link description here
OpenSSL 1.1.1 enter link description here
Note:
Global Configuration file : /etc/nginx/nginx.conf
Document Root Directory : /usr/share/nginx/html
Customised Configuration File: /etc/nginx/conf.d/<name.conf>
Installation procedure:
Check the version of CentOS as follows
[root@linuxhelp ~]# cat /etc/centos-release
CentOS Linux release 7.6.1810 (Core)
Install the following packages
root@linuxhelp ~]# yum install vim wget curl tree -y
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: mirrors.123host.vn
* extras: mirror.dhakacom.com
* updates: mirrors.123host.vn
base | 3.6 kB 00:00:00
extras | 3.4 kB 00:00:00
updates | 3.4 kB 00:00:00
(1/2): extras/7/x86_64/primary_db | 215 kB 00:00:01
(2/2): updates/7/x86_64/primary_db | 7.4 MB 00:00:11
Resolving Dependencies
--> Running transaction check
---> Package curl.x86_64 0:7.29.0-51.el7 will be updated
.
.
.
.
.
.
Installed:
tree.x86_64 0:1.6.0-10.el7
Updated:
curl.x86_64 0:7.29.0-51.el7_6.3 vim-enhanced.x86_64 2:7.4.160-6.el7_6 wget.x86_64 0:1.14-18.el7_6.1
Dependency Updated:
libcurl.x86_64 0:7.29.0-51.el7_6.3 vim-common.x86_64 2:7.4.160-6.el7_6
Complete!
Install the Compiler Tools by executing the following command
[root@linuxhelp ~]# yum groupinstall "Development Tools" -y
Loaded plugins: fastestmirror, langpacks
There is no installed groups file.
Maybe run: yum groups mark convert (see man yum)
Loading mirror speeds from cached hostfile
* base: mirrors.123host.vn
* extras: mirror.dhakacom.com
* updates: mirrors.123host.vn
Resolving Dependencies
--> Running transaction check
---> Package autoconf.noarch 0:2.69-11.el7 will be installed
--> Processing Dependency: m4 >= 1.4.14 for package: autoconf-2.69-11.el7.noarch
.
.
.
.
.
.
Installed:
autoconf.noarch 0:2.69-11.el7 automake.noarch 0:1.13.4-3.el7 bison.x86_64 0:3.0.4-2.el7
byacc.x86_64 0:1.9.20130304-3.el7 cscope.x86_64 0:15.8-10.el7 ctags.x86_64 0:5.8-13.el7
diffstat.x86_64 0:1.57-4.el7 doxygen.x86_64 1:1.8.5-3.el7 flex.x86_64 0:2.5.37-6.el7
gcc.x86_64 0:4.8.5-36.el7_6.2 gcc-c++.x86_64 0:4.8.5-36.el7_6.2 gcc-gfortran.x86_64 0:4.8.5-36.el7_6.2
git.x86_64 0:1.8.3.1-20.el7 indent.x86_64 0:2.2.11-13.el7 intltool.noarch 0:0.50.2-7.el7
libtool.x86_64 0:2.4.2-22.el7_3 patch.x86_64 0:2.7.1-10.el7_5 patchutils.x86_64 0:0.3.3-4.el7
rcs.x86_64 0:5.9.0-5.el7 redhat-rpm-config.noarch 0:9.1.0-87.el7.centos rpm-build.x86_64 0:4.11.3-35.el7
rpm-sign.x86_64 0:4.11.3-35.el7 subversion.x86_64 0:1.7.14-14.el7 swig.x86_64 0:2.0.10-5.el7
systemtap.x86_64 0:3.3-3.el7
Dependency Installed:
apr.x86_64 0:1.4.8-3.el7_4.1 apr-util.x86_64 0:1.5.2-6.el7 cpp.x86_64 0:4.8.5-36.el7_6.2
dwz.x86_64 0:0.11-3.el7 gettext-common-devel.noarch 0:0.19.8.1-2.el7 gettext-devel.x86_64 0:0.19.8.1-2.el7
glibc-devel.x86_64 0:2.17-260.el7_6.6 glibc-headers.x86_64 0:2.17-260.el7_6.6 kernel-debug-devel.x86_64 0:3.10.0-957.27.2.el7
kernel-headers.x86_64 0:3.10.0-957.27.2.el7 libgfortran.x86_64 0:4.8.5-36.el7_6.2 libquadmath.x86_64 0:4.8.5-36.el7_6.2
libquadmath-devel.x86_64 0:4.8.5-36.el7_6.2 libstdc++-devel.x86_64 0:4.8.5-36.el7_6.2 m4.x86_64 0:1.4.16-10.el7
perl-Data-Dumper.x86_64 0:2.145-3.el7 perl-Error.noarch 1:0.17020-2.el7 perl-Git.noarch 0:1.8.3.1-20.el7
perl-TermReadKey.x86_64 0:2.30-20.el7 perl-Test-Harness.noarch 0:3.28-3.el7 perl-Thread-Queue.noarch 0:3.02-2.el7
perl-XML-Parser.x86_64 0:2.41-10.el7 perl-srpm-macros.noarch 0:1-8.el7 subversion-libs.x86_64 0:1.7.14-14.el7
systemtap-client.x86_64 0:3.3-3.el7 systemtap-devel.x86_64 0:3.3-3.el7
Dependency Updated:
glibc.x86_64 0:2.17-260.el7_6.6 glibc-common.x86_64 0:2.17-260.el7_6.6 libgcc.x86_64 0:4.8.5-36.el7_6.2
libgomp.x86_64 0:4.8.5-36.el7_6.2 libstdc++.x86_64 0:4.8.5-36.el7_6.2
Complete!
Download the Nginx 1.17.3 Version using the following link
[root@linuxhelp ~]# wget https://nginx.org/download/nginx-1.17.3.tar.gz
--2019-08-26 08:01:39-- https://nginx.org/download/nginx-1.17.3.tar.gz
Resolving nginx.org (nginx.org)... 62.210.92.35, 95.211.80.227, 2001:1af8:4060:a004:21::e3
Connecting to nginx.org (nginx.org)|62.210.92.35|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1034586 (1010K) [application/octet-stream]
Saving to: ‘nginx-1.17.3.tar.gz’
100%[===================================================================================================>] 1,034,586 69.0KB/s in 14s
2019-08-26 08:01:54 (69.9 KB/s) - ‘nginx-1.17.3.tar.gz’ saved [1034586/1034586]
Download the pcre library latest version
[root@linuxhelp ~]# wget https://ftp.pcre.org/pub/pcre/pcre-8.43.tar.gz
--2019-08-26 08:02:18-- https://ftp.pcre.org/pub/pcre/pcre-8.43.tar.gz
Resolving ftp.pcre.org (ftp.pcre.org)... 131.111.8.88
Connecting to ftp.pcre.org (ftp.pcre.org)|131.111.8.88|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 2085854 (2.0M) [application/x-gunzip]
Saving to: ‘pcre-8.43.tar.gz’
100%[===================================================================================================>] 2,085,854 595KB/s in 3.4s
2019-08-26 08:02:23 (595 KB/s) - ‘pcre-8.43.tar.gz’ saved [2085854/2085854]
Download the zlib latest version
[root@linuxhelp ~]# wget https://www.zlib.net/zlib-1.2.11.tar.xz
--2019-08-26 08:02:55-- https://www.zlib.net/zlib-1.2.11.tar.xz
Resolving www.zlib.net (www.zlib.net)... 68.66.224.164
Connecting to www.zlib.net (www.zlib.net)|68.66.224.164|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 467960 (457K) [application/x-xz]
Saving to: ‘zlib-1.2.11.tar.xz’
100%[===================================================================================================>] 467,960 332KB/s in 1.4s
2019-08-26 08:02:58 (332 KB/s) - ‘zlib-1.2.11.tar.xz’ saved [467960/467960]
Download the OpenSSL latest version using the following link
[root@linuxhelp ~]# wget https://github.com/openssl/openssl/archive/OpenSSL_1_1_1-stable.zip
--2019-08-26 08:03:35-- https://github.com/openssl/openssl/archive/OpenSSL_1_1_1-stable.zip
Resolving github.com (github.com)... 13.234.176.102
Connecting to github.com (github.com)|13.234.176.102|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://codeload.github.com/openssl/openssl/zip/OpenSSL_1_1_1-stable [following]
--2019-08-26 08:03:36-- https://codeload.github.com/openssl/openssl/zip/OpenSSL_1_1_1-stable
Resolving codeload.github.com (codeload.github.com)... 13.127.152.42
Connecting to codeload.github.com (codeload.github.com)|13.127.152.42|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [application/zip]
Saving to: ‘OpenSSL_1_1_1-stable.zip’
[ <=> ] 10,882,191 1.18MB/s in 10s
2019-08-26 08:03:46 (1.04 MB/s) - ‘OpenSSL_1_1_1-stable.zip’ saved [10882191]
List the directories to view the downloaded source code
[root@linuxhelp ~]# ls -la
total 14192
dr-xr-x---. 16 root root 4096 Aug 26 08:03 .
dr-xr-xr-x. 17 root root 244 Dec 21 2018 ..
-rw-------. 1 root root 2097 Dec 9 2017 anaconda-ks.cfg
-rw-------. 1 root root 548 Aug 26 07:40 .bash_history
-rw-r--r--. 1 root root 18 Dec 29 2013 .bash_logout
-rw-r--r--. 1 root root 176 Dec 29 2013 .bash_profile
-rw-r--r--. 1 root root 176 Dec 29 2013 .bashrc
drwx------. 17 root root 4096 Jan 29 2019 .cache
drwx------. 15 root root 280 Jan 29 2019 .config
-rw-r--r--. 1 root root 100 Dec 29 2013 .cshrc
drwx------. 3 root root 25 Dec 12 2017 .dbus
drwxr-xr-x. 2 root root 6 Dec 12 2017 Desktop
drwxr-xr-x. 2 root root 6 Dec 12 2017 Documents
drwxr-xr-x. 2 root root 6 Dec 12 2017 Downloads
-rw-------. 1 root root 16 Dec 12 2017 .esd_auth
drwx------ 2 root root 79 Jan 29 2019 .gnupg
-rw-------. 1 root root 1876 Mar 9 15:37 .ICEauthority
-rw-r--r--. 1 root root 2128 Dec 12 2017 initial-setup-ks.cfg
drwx------. 3 root root 19 Dec 12 2017 .local
drwxr-xr-x. 2 root root 6 Dec 12 2017 Music
-rw-r--r-- 1 root root 1034586 Aug 13 22:31 nginx-1.17.3.tar.gz
-rw-r--r-- 1 root root 10882191 Aug 26 08:03 OpenSSL_1_1_1-stable.zip
-rw-r--r-- 1 root root 2085854 Feb 23 2019 pcre-8.43.tar.gz
drwxr-xr-x. 2 root root 6 Dec 12 2017 Pictures
drwxr-xr-x. 2 root root 6 Dec 12 2017 Public
drwx------ 2 root root 6 Jan 29 2019 .ssh
-rw-r--r--. 1 root root 129 Dec 29 2013 .tcshrc
drwxr-xr-x. 2 root root 6 Dec 12 2017 Templates
drwxr-xr-x. 2 root root 6 Dec 12 2017 Videos
-rw------- 1 root root 854 Aug 26 07:39 .viminfo
-rw-r--r-- 1 root root 467960 Jan 15 2017 zlib-1.2.11.tar.xz
Extract the tar file of nginx
[root@linuxhelp ~]# tar xzf nginx-1.17.3.tar.gz
Extract the zip file of OpenSSL as follows
[root@linuxhelp ~]# unzip OpenSSL_1_1_1-stable.zip
Archive: OpenSSL_1_1_1-stable.zip
4bdab2571782393e4ba3acb8578c415ce1575a75
creating: openssl-OpenSSL_1_1_1-stable/
inflating: openssl-OpenSSL_1_1_1-stable/ACKNOWLEDGEMENTS
inflating: openssl-OpenSSL_1_1_1-stable/AUTHORS
inflating: openssl-OpenSSL_1_1_1-stable/CHANGES
inflating: openssl-OpenSSL_1_1_1-stable/CONTRIBUTING
creating: openssl-OpenSSL_1_1_1-stable/Configurations/
inflating: openssl-OpenSSL_1_1_1-stable/Configurations/00-base-templates.conf
inflating: openssl-OpenSSL_1_1_1-stable/Configurations/10-main.conf
.
.
.
.
inflating: openssl-OpenSSL_1_1_1-stable/util/perl/with_fallback.pm
inflating: openssl-OpenSSL_1_1_1-stable/util/private.num
inflating: openssl-OpenSSL_1_1_1-stable/util/process_docs.pl
inflating: openssl-OpenSSL_1_1_1-stable/util/shlib_wrap.sh.in
inflating: openssl-OpenSSL_1_1_1-stable/util/su-filter.pl
inflating: openssl-OpenSSL_1_1_1-stable/util/unlocal_shlib.com.in
Extract the tar files of pcre and zlib dependencies as follows
[root@linuxhelp ~]# tar xzf pcre-8.43.tar.gz
oot@linuxhelp ~]# tar xJf zlib-1.2.11.tar.xz
Install the dependencies that are required to install the Nginx Installation
[root@linuxhelp ~]# yum install -y perl perl-devel perl-ExtUtils-Embed libxslt libxslt-devel libxml2 libxml2-devel gd gd-devel GeoIP GeoIP-devel -y
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: mirrors.123host.vn
* extras: mirror.dhakacom.com
* updates: mirrors.123host.vn
Package 4:perl-5.16.3-294.el7_6.x86_64 already installed and latest version
Package libxslt-1.1.28-5.el7.x86_64 already installed and latest version
Package libxml2-2.9.1-6.el7_2.3.x86_64 already installed and latest version
Package gd-2.0.35-26.el7.x86_64 already installed and latest version
Package GeoIP-1.5.0-13.el7.x86_64 already installed and latest version
Resolving Dependencies
--> Running transaction check
---> Package GeoIP-devel.x86_64 0:1.5.0-13.el7 will be installed
---> Package gd-devel.x86_64 0:2.0.35-26.el7 will be installed
--> Processing Dependency: zlib-devel for package: gd-devel-2.0.35-26.el7.x86_64
.
.
.
.
.
.
.
Installed:
GeoIP-devel.x86_64 0:1.5.0-13.el7 gd-devel.x86_64 0:2.0.35-26.el7 libxml2-devel.x86_64 0:2.9.1-6.el7_2.3
libxslt-devel.x86_64 0:1.1.28-5.el7 perl-ExtUtils-Embed.noarch 0:1.30-294.el7_6 perl-devel.x86_64 4:5.16.3-294.el7_6
Dependency Installed:
expat-devel.x86_64 0:2.1.0-10.el7_3 fontconfig-devel.x86_64 0:2.13.0-4.3.el7 freetype-devel.x86_64 0:2.8-12.el7_6.1
gdbm-devel.x86_64 0:1.10-8.el7 libX11-devel.x86_64 0:1.6.5-2.el7 libXau-devel.x86_64 0:1.0.8-2.1.el7
libXpm-devel.x86_64 0:3.5.12-1.el7 libdb-devel.x86_64 0:5.3.21-24.el7 libgcrypt-devel.x86_64 0:1.5.3-14.el7
libgpg-error-devel.x86_64 0:1.12-3.el7 libjpeg-turbo-devel.x86_64 0:1.2.90-6.el7 libpng-devel.x86_64 2:1.5.13-7.el7_2
libuuid-devel.x86_64 0:2.23.2-59.el7_6.1 libxcb-devel.x86_64 0:1.13-1.el7 perl-ExtUtils-Install.noarch 0:1.58-294.el7_6
perl-ExtUtils-MakeMaker.noarch 0:6.68-3.el7 perl-ExtUtils-Manifest.noarch 0:1.61-244.el7 perl-ExtUtils-ParseXS.noarch 1:3.18-3.el7
systemtap-sdt-devel.x86_64 0:3.3-3.el7 xorg-x11-proto-devel.noarch 0:2018.4-1.el7 xz-devel.x86_64 0:5.2.2-1.el7
zlib-devel.x86_64 0:1.2.7-18.el7
Dependency Updated:
libblkid.x86_64 0:2.23.2-59.el7_6.1 libmount.x86_64 0:2.23.2-59.el7_6.1 libsmartcols.x86_64 0:2.23.2-59.el7_6.1
libuuid.x86_64 0:2.23.2-59.el7_6.1 util-linux.x86_64 0:2.23.2-59.el7_6.1
Complete!
List the directories to view the extracted directories
[root@linuxhelp ~]# ls -la
total 14212
dr-xr-x---. 20 root root 4096 Aug 26 08:07 .
dr-xr-xr-x. 17 root root 244 Dec 21 2018 ..
drwxr-xr-x. 2 root root 6 Dec 12 2017 Documents
drwxr-xr-x 8 1001 1001 158 Aug 13 18:16 nginx-1.17.3
-rw-r--r-- 1 root root 1034586 Aug 13 22:31 nginx-1.17.3.tar.gz
-rw-r--r-- 1 root root 10882191 Aug 26 08:03 OpenSSL_1_1_1-stable.zip
drwxr-xr-x 18 root root 4096 Aug 24 12:15 openssl-OpenSSL_1_1_1-stable
drwxr-xr-x 7 1169 1169 8192 Feb 23 2019 pcre-8.43
-rw-r--r-- 1 root root 2085854 Feb 23 2019 pcre-8.43.tar.gz
-rw------- 1 root root 854 Aug 26 07:39 .viminfo
drwxr-xr-x 14 501 games 4096 Jan 15 2017 zlib-1.2.11
-rw-r--r-- 1 root root 467960 Jan 15 2017 zlib-1.2.11.tar.xz
Remove all the tar files of downloaded dependencies
[root@linuxhelp ~]# rm -rf *.tar.*
Remove the downloaded dependency zip file as follows
[root@linuxhelp ~]# rm -rf *.zip
List the directories to verify the files
[root@linuxhelp ~]# ls -la
total 72
dr-xr-x---. 20 root root 4096 Aug 26 08:09 .
dr-xr-xr-x. 17 root root 244 Dec 21 2018 ..
drwxr-xr-x. 2 root root 6 Dec 12 2017 Documents
drwxr-xr-x 8 1001 1001 158 Aug 13 18:16 nginx-1.17.3
drwxr-xr-x 18 root root 4096 Aug 24 12:15 openssl-OpenSSL_1_1_1-stable
drwxr-xr-x 7 1169 1169 8192 Feb 23 2019 pcre-8.43
-rw------- 1 root root 854 Aug 26 07:39 .viminfo
drwxr-xr-x 14 501 games 4096 Jan 15 2017 zlib-1.2.11
Navigate to nginx Folder
[root@linuxhelp ~]# cd nginx-1.17.3/
List the directories inside it.
[root@linuxhelp nginx-1.17.3]# ls -la
total 756
drwxr-xr-x 8 1001 1001 158 Aug 13 18:16 .
dr-xr-x---. 20 root root 4096 Aug 26 08:09 ..
drwxr-xr-x 6 1001 1001 326 Aug 26 08:04 auto
-rw-r--r-- 1 1001 1001 298761 Aug 13 18:16 CHANGES
-rw-r--r-- 1 1001 1001 455879 Aug 13 18:16 CHANGES.ru
drwxr-xr-x 2 1001 1001 168 Aug 26 08:04 conf
-rwxr-xr-x 1 1001 1001 2502 Aug 13 18:15 configure
drwxr-xr-x 4 1001 1001 72 Aug 26 08:04 contrib
drwxr-xr-x 2 1001 1001 40 Aug 26 08:04 html
-rw-r--r-- 1 1001 1001 1397 Aug 13 18:15 LICENSE
drwxr-xr-x 2 1001 1001 21 Aug 26 08:04 man
-rw-r--r-- 1 1001 1001 49 Aug 13 18:15 README
drwxr-xr-x 9 1001 1001 91 Aug 26 08:04 src
Change the directory to man
[root@linuxhelp nginx-1.17.3]# cd man
List the directory to view the files inside the man directory
[root@linuxhelp man]# ls -la
total 8
drwxr-xr-x 2 1001 1001 21 Aug 26 08:04 .
drwxr-xr-x 8 1001 1001 158 Aug 13 18:16 ..
-rw-r--r-- 1 1001 1001 5284 Aug 13 18:15 nginx.8
Copy the Nginx manual page to the following location
[root@linuxhelp man]# cp /root/nginx-1.17.3/man/nginx.8 /usr/share/ma
magic man/ maven-effective-poms/ maven-fragments/ maven-poms/
[root@linuxhelp man]# cp /root/nginx-1.17.3/man/nginx.8 /usr/share/man/man8
Compress the manual page of Nginx using gzip as follows
[root@linuxhelp man]# gzip /usr/share/man/man8/nginx.8
Now verify the Man page of nginx By executing the following command
[root@linuxhelp man]# man nginx
Navigate to nginx Folder
[root@linuxhelp man]# cd /root/nginx-1.17.3/
List the directories inside the folder
[root@linuxhelp nginx-1.17.3]# ls
auto CHANGES CHANGES.ru conf configure contrib html LICENSE man README src
Configure Nginx with the following options
[root@linuxhelp nginx-1.17.3]# ./configure --prefix=/etc/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 --pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock --user=nginx --group=nginx --build=CentOS --builddir=nginx-1.17.3 --with-select_module --with-poll_module --with-threads --with-file-aio --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_geoip_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_auth_request_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-perl_modules_path=/usr/lib64/perl5 --with-perl=/usr/bin/perl --http-log-path=/var/log/nginx/access.log --http-client-body-temp-path=/var/cache/nginx/client_temp --http-proxy-temp-path=/var/cache/nginx/proxy_temp --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp --http-scgi-temp-path=/var/cache/nginx/scgi_temp --with-mail=dynamic --with-mail_ssl_module --with-stream=dynamic --with-stream_ssl_module --with-stream_realip_module --with-stream_geoip_module=dynamic --with-stream_ssl_preread_module --with-compat --with-pcre=../pcre-8.43 --with-pcre-jit --with-zlib=../zlib-1.2.11 --with-openssl=../openssl-OpenSSL_1_1_1-stable --with-openssl-opt=no-nextprotoneg --with-debug
checking for OS
+ Linux 3.10.0-957.5.1.el7.x86_64 x86_64
checking for C compiler ... found
+ using GNU C compiler
+ gcc version: 4.8.5 20150623 (Red Hat 4.8.5-36) (GCC)
checking for gcc -pipe switch ... found
checking for -Wl,-E switch ... found
checking for gcc builtin atomic operations ... found
checking for C99 variadic macros ... found
checking for gcc variadic macros ... found
checking for gcc builtin 64 bit byteswap ... found
checking for unistd.h ... found
checking for inttypes.h ... found
checking for limits.h ... found
checking for sys/filio.h ... not found
checking for sys/param.h ... found
checking for sys/mount.h ... found
checking for sys/statvfs.h ... found
.
.
.
.
.
.
nginx http proxy temporary files: "/var/cache/nginx/proxy_temp"
nginx http fastcgi temporary files: "/var/cache/nginx/fastcgi_temp"
nginx http uwsgi temporary files: "/var/cache/nginx/uwsgi_temp"
nginx http scgi temporary files: "/var/cache/nginx/scgi_temp"
Now,build the software of nginx using make command
[root@linuxhelp nginx-1.17.3]# make
make -f nginx-1.17.3/Makefile
make[1]: Entering directory `/root/nginx-1.17.3'
cd ../pcre-8.43 \
&& if [ -f Makefile ]; then make distclean; fi \
&& CC="cc" CFLAGS="-O2 -fomit-frame-pointer -pipe " \
./configure --disable-shared --enable-jit
checking for a BSD-compatible install... /usr/bin/install -c
.
.
.
.
.
sed -e "s|PREFIX|/etc/nginx|" \
-e "s|PID_PATH|/var/run/nginx.pid|" \
-e "s|CONF_PATH|/etc/nginx/nginx.conf|" \
-e "s|ERROR_LOG_PATH|/var/log/nginx/error.log|" \
< man/nginx.8 > nginx-1.17.3/nginx.8
make[1]: Leaving directory `/root/nginx-1.17.3'
Now install the Nginx using the Built software as follows
[root@linuxhelp nginx-1.17.3]# make install
make -f nginx-1.17.3/Makefile install
make[1]: Entering directory `/root/nginx-1.17.3'
cd nginx-1.17.3/src/http/modules/perl && make install
make[2]: Entering directory `/root/nginx-1.17.3/nginx-1.17.3/src/http/modules/perl'
Files found in blib/arch: installing files in blib/lib into architecture dependent library tree
Installing /usr/lib64/perl5/x86_64-linux-thread-multi/auto/nginx/nginx.so
Installing /usr/lib64/perl5/x86_64-linux-thread-multi/auto/nginx/nginx.bs
Installing /usr/lib64/perl5/x86_64-linux-thread-multi/nginx.pm
Installing /usr/lib64/perl5/man3/nginx.3pm
Appending installation info to /usr/lib64/perl5/x86_64-linux-thread-multi/perllocal.pod
make[2]: Leaving directory `/root/nginx-1.17.3/nginx-1.17.3/src/http/modules/perl'
test -d '/etc/nginx' || mkdir -p '/etc/nginx'
.
.
.
.
.
cp nginx-1.17.3/ngx_stream_module.so '/usr/lib64/nginx/modules/ngx_stream_module.so'
make[1]: Leaving directory `/root/
Create a Soft link for Nginx modules as follows
[root@linuxhelp nginx-1.17.3]# ln -s /usr/share/nginx/modules /etc/nginx/modules
Now,Check the version of Nginx
[root@linuxhelp nginx-1.17.3]# nginx -V
nginx version: nginx/1.17.3 (CentOS)
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-36) (GCC)
built with OpenSSL 1.1.1d-dev xx XXX xxxx
TLS SNI support enabled
configure arguments: --prefix=/etc/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 --pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock --user=nginx --group=nginx --build=CentOS --builddir=nginx-1.17.3 --with-select_module --with-poll_module --with-threads --with-file-aio --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_geoip_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_auth_request_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-perl_modules_path=/usr/lib64/perl5 --with-perl=/usr/bin/perl --http-log-path=/var/log/nginx/access.log --http-client-body-temp-path=/var/cache/nginx/client_temp --http-proxy-temp-path=/var/cache/nginx/proxy_temp --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp --http-scgi-temp-path=/var/cache/nginx/scgi_temp --with-mail=dynamic --with-mail_ssl_module --with-stream=dynamic --with-stream_ssl_module --with-stream_realip_module --with-stream_geoip_module=dynamic --with-stream_ssl_preread_module --with-compat --with-pcre=../pcre-8.43 --with-pcre-jit --with-zlib=../zlib-1.2.11 --with-openssl=../openssl-OpenSSL_1_1_1-stable --with-openssl-opt=no-nextprotoneg --with-debug
Create nginx User and Group
[root@linuxhelp nginx-1.17.3]# useradd --system --home /var/cache/nginx --shell /sbin/nologin --comment "nginx user" --user-group nginx
Check the potential errors in Nginx configuration File
[root@linuxhelp nginx-1.17.3]# nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
Create a system unit file for Nginx as follows
[root@linuxhelp nginx-1.17.3]# vim /etc/systemd/system/nginx.service
[Unit]
Description=nginx - high performance web server
Documentation=https://nginx.org/en/docs/
After=network-online.target remote-fs.target nss-lookup.target
Wants=network-online.target
[Service]
Type=forking
PIDFile=/var/run/nginx.pid
ExecStartPre=/usr/sbin/nginx -t -c /etc/nginx/nginx.conf
ExecStart=/usr/sbin/nginx -c /etc/nginx/nginx.conf
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s TERM $MAINPID
[Install]
WantedBy=multi-user.target
Enable the service of Nginx as follows
[root@linuxhelp nginx-1.17.3]# systemctl enable nginx.service
Created symlink from /etc/systemd/system/multi-user.target.wants/nginx.service to /etc/systemd/system/nginx.service. Start the service of nginx as follows
[root@linuxhelp nginx-1.17.3]# systemctl start nginx.service
Check the status of nginx as follows
[root@linuxhelp nginx-1.17.3]# systemctl status nginx
● nginx.service - nginx - high performance web server
Loaded: loaded (/etc/systemd/system/nginx.service; enabled; vendor preset: disabled)
Active: active (running) since Mon 2019-08-26 08:43:16 IST; 19s ago
Open the browser and enter the URL as follows to view the Default page of Nginx which represents the Successful Installation of nginx.

With this,Installation of Nginx 1.17.3 on CentOS 7.6 using Source Code comes to end here.
Comments ( 0 )
No comments available