Aristotle
发布于 2023-02-12 / 6 阅读 / 0 评论 / 0 点赞

nginx-安装新模块

nginx-安装新模块

前提确保nginx命令在PATH下(配置/etc/profile,export PATH变量)

1.查看安装模块

nginx -V

[ec2-user@ip-172-31-6-9 nginx-1.18.0]$ nginx -V
nginx version: nginx/1.18.0
built by gcc 7.3.1 20180712 (Red Hat 7.3.1-15) (GCC) 
built with OpenSSL 1.0.2k-fips  26 Jan 2017
TLS SNI support enabled
configure arguments: --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_v2_module

2.进入nginx源码目录(进入自己的源码目录)

cd /home/ec2-user/soft-file/nginx-1.18.0

3. 配置编译参数

configure --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_v2_module --with-其他模块

4. 编译,不要install

make

5. 复制和备份nginx运行文件

cp nginx运行目录下/sbin/nginx nginx.bak
cp objs/nginx nginx运行目录下/sbin/

6. 重启nginx(前置条件已经配置systemd脚本)

[ec2-user@ip-172-31-6-9 objs]$ sudo systemctl restart nginx