一、安装包下载
下载地址:http://nginx.org/
其他安装包:
pcre-8.37.tar.gz(http://downloads.sourceforge.net/project/pcre/pcre/8.37/pcre-8.37.tar.gz)
nginx-1.20.1.tar.gz (http://nginx.org/download/nginx-1.20.1.tar.gz)
安装参考:https://cloud.tencent.com/developer/article/1619507
二、安装nginx
1. 安装pcre(或yum安装)
[root@hadoop103 ~]# yum install gcc-c++
[root@hadoop103 ~]# cd /opt/software/
[root@hadoop103 software]# tar -zxvf pcre-8.37.tar.gz
[root@hadoop103 software]# cd pcre-8.37
[root@hadoop103 pcre-8.37]# ./configure
[root@hadoop103 pcre-8.37]# make
[root@hadoop103 pcre-8.37]# make install
2. 安装openssl、zlib
[root@hadoop103 pcre]# yum -y install gcc gcc-c++ pcre pcre-devel zlib zlib-devel openssl openssl-devel
3. 安装nginx
[root@hadoop103 pcre-8.37]# groupadd nginx
[root@hadoop103 pcre-8.37]# useradd nginx -g nginx -s /sbin/nologin -M
[root@hadoop103 pcre-8.37]# mkdir /usr/local/nginx && mkdir /var/log/nginx && mkdir /var/cache/nginx
[root@hadoop103 pcre-8.37]# cd /opt/software
[root@hadoop103 software]# tar -zxvf nginx-1.17.0.tar.gz
[root@hadoop103 software]# cd nginx-1.17.0
[root@hadoop103 nginx-1.17.0]# ./configure
./configure \--prefix=/usr/local/nginx \--error-log-path=/var/log/nginx/error.log \--http-log-path=/var/log/nginx/access.log \--pid-path=/var/run/nginx.pid \--lock-path=/var/run/nginx.lock \--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 \--user=nginx \--group=nginx \--with-file-aio \--with-threads \--with-http_addition_module \--with-http_auth_request_module \--with-http_dav_module \--with-http_flv_module \--with-http_gunzip_module \--with-http_gzip_static_module \--with-http_mp4_module \--with-http_random_index_module \--with-http_realip_module \--with-http_secure_link_module \--with-http_slice_module \--with-http_ssl_module \--with-http_stub_status_module \--with-http_sub_module \--with-http_v2_module \--with-mail \--with-mail_ssl_module \--with-stream \--with-stream_realip_module \--with-stream_ssl_module \--with-stream_ssl_preread_module
[root@hadoop103 nginx-1.17.0]# make && make install
4. 启停nginx
[root@hadoop103 nginx-1.17.0]# cd /usr/local/nginx/sbin
[root@hadoop103 sbin]# ./nginx (启动nginx)
[root@hadoop103 sbin]# ./nginx -s stop (关闭nginx)
[root@hadoop103 sbin]# ./nginx -s reload (修改配置文件后,重新加载,即无需重启服务)
