nginx1.17.2 version of the source installation
A: install dependencies NGINX
1: PCRE - supports regular expressions. NGINX Core and Rewrite module requires.
$ wget https://ftp.pcre.org/pub/pcre/pcre-8.43.tar.gz
$ Tar -zxf pcre-8.42.tar.gz
$ cd pcre-8.42
$ ./configure
$ make
$ sudo make install
2: zlib - support for header compression. NGINX Gzip module requires.
$ wget http://zlib.net/zlib-1.2.11.tar.gz
$ tar -zxf zlib-1.2.11.tar.gz
$ cd zlib-1.2.11
$ ./configure
$ make
$ sudo make install
3: OpenSSL - support the HTTPS protocol. NGINX SSL modules and other personnel requirements.
$ wget http://www.openssl.org/source/openssl-1.1.1b.tar.gz
$ tar -zxf openssl-1.1.1b.tar.gz
$ cd openssl-1.1.1b
./config --prefix=/usr/local/ssl shared zlib-dynamic
$ make
$ sudo make install
II: Installation ngixn-1.17.2 version
$ wget https://nginx.org/download/nginx-1.17.2.tar.gz
$ Tar zxf nginx-1.17.2.tar.gz
$ cd nginx-1.17.2
./configure --sbin-path=/usr/local/nginx/nginx \
--conf-path=/usr/local/nginx/nginx.conf \
--pid-path=/usr/local/nginx/nginx.pid \
--with-http_ssl_module \
--with-pcre=../pcre-8.43 \
--with-zlib=../zlib-1.2.11 \
--with-openssl=../openssl-1.1.1b \
Three: centos7.x nginx will add service to boot from Kai
1: Create a file nginx.service
vim /lib/systemd/system/nginx.service
[Unit]
Description=nginx service
After=network.target
[Service]
Type=forking
ExecStart=/usr/local/nginx/nginx
ExecReload=/usr/local/nginx/nginx -s reload
ExecStop=/usr/local/nginx/nginx -s quit
PrivateTmp=true
[Install]
WantedBy=multi-user.target
2: At this point in systemctl you can see the list of services in the nginx.service
systemctl list-unit-files | grep nginx
3: nginx added service from the start
systemctl enable nginx.service
Four: firewall open port 80
firewall-cmd --zone=public --add-port=80/tcp --permanent
firewall-cmd --reload
Five: Start nginx Service
systemctl start nginx.service