1、安装依赖包
yum install -y gcc gcc-c++ pcre pcre-devel zlib zlib-devel openssl openssl-devel
2、下载安装包
wget http://nginx.org/download/nginx-1.19.6.tar.gz
#打补丁 nginx_upstream_check_module模块
wget https://github.com/yaoweibin/nginx_upstream_check_module/archive/v0.3.0.tar.gz
tar zxvf v0.3.0.tar.gz
3、解压并安装
tar zxvf nginx-1.19.6.tar.gz
cd nginx-1.19.6/
#配置
./configure --prefix=/usr/local/nginx \
--with-http_stub_status_module \
--with-http_ssl_module \
--with-stream \
--with-file-aio \
--with-http_realip_module \
--add-module=../nginx_upstream_check_module-0.3.0 \
--with-stream_ssl_module
./configure: error: C compiler cc is not found
yum install gcc
问题:-bash:make_ command not found
yum -y install gcc automake autoconf libtool make
4、编译安装
make && make install
5、启动
cd /usr/local/nginx
测试文件正确性:./sbin/nginx -t
nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful
启动nginx: ./sbin/nginx
重启nginx: ./sbin/nginx -s reload