环境 centos 7.9
nginx-1.18
安装方式 编译安装
用途:实验项目
预装:
yum install -y gcc-c++
1、安装 pcre -- 正则库
官网: https://sourceforge.net/projects/pcre/files/pcre/
wget -cO pcre-8.44.tar.gz https://sourceforge.net/projects/pcre/files/pcre/8.44/pcre-8.44.tar.gz/download
tar xf pcre-8.44.tar.gz
./configure
make && make install
验证 pcre-config --version
2、安装 zlib-1.2.11 压缩
地址 http://www.zlib.net/
tar zxf zlib-1.2.11.tar.gz
./configure
make && make install
nginx 安装:
Nginx下载: https://nginx.org/en/download.html
创建用户: useradd -r -s /sbin/nologin nginx
解压 tar -xf nginx-1.18.0.tar.gz
cd nginx-1.18.0/
./configure
--prefix=/usr/local/nginx
--user=nginx
--group=nginx
--with-http_stub_status_module
--with-http_ssl_module
--with-http_realip_module
--with-http_gzip_static_module
--with-http_v2_module
--with-pcre
--with-stream
--with-stream_ssl_module
--with-stream_realip_module
#--with-zlib=/usr/local/src/zlib-1.2.11
#--with-pcre=/usr/local/src/pcre-8.44
注解:
#./configure --prefix=/usr/local/nginx --without-http_memcached_module --user=www --group=www --with-http_stub_status_module --with-openssl=/usr/ --with-pcre=/usr/local/src/pcre-8.36
#注意:--with-pcre=/usr/local/src/pcre-8.44 指向的是源码包解压的路径,而不是组件安装的路径,其他亦然
make
make install
查看是否成功 /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