相关依赖
yum updateyum install wgetwget http://nginx.org/download/nginx-1.19.1.tar.gz ## nginx 源码包wget https://ftp.pcre.org/pub/pcre/pcre-8.44.tar.gz ## 正则会用到wget https://zlib.net/zlib-1.2.11.tar.gz ##gzip 模块tar xf 指定文件解压
./configure --help 查看编译帮助命令
--help print this message--prefix=PATH nginx总相对路径 下面都可以 默认以相对路径创建--sbin-path=PATH set nginx binary pathname--modules-path=PATH set modules path--conf-path=PATH set nginx.conf pathname--error-log-path=PATH set error log pathname--pid-path=PATH set nginx.pid pathname--lock-path=PATH set nginx.lock pathname--user=USER nginx配置文件生效启动用户--with开头都是可以单独指定需要使用的模块--without 开头指定不需要的模块还有一些指定模块路径的参数
我使用的配置参数
./configure --prefix=/usr/local/nginx \--with-pcre=/usr/local/nginx_rely/rely/pcre-8.44 \--with-zlib=/usr/local/nginx_rely/rely/zlib-1.2.11 \--with-http_ssl_module \--with-http_image_filter_module \--with-http_stub_status_module
期间根据环境可能需要安装下面三个东西
yum -y install gcc gcc-c++ openssl openssl-devel gd gd-devel
出现这样 差不多就检测成功了

make 编译 生成Makefilemake install
去安装目录启动

设置软连接
ln -s /usr/local/nginx/sbin/nginx /usr/bin/nginxnginx -h 查看具体命令注意:请在运行 nginx 时,使用绝对路径。因为热部署USR2是通过绝对路径寻找
