Nginx重新编译添加模块的方法
编译安装Nginx的时候,有些模块默认并不会安装,比如http_ssl_module,那么为了让Nginx支持HTTPS,必须添加这个模块。
下面讲解如何在已经安装过后再次添加新的模块。
1、找到安装nginx的源码根目录(即安装包存放目录),如果没有的话下载新的源码并解压
cd software ls nginx-1.10.2 nginx-1.10.2.tar.gz
2、查看nginx版本极其编译参数
/usr/local/nginx/sbin/nginx -V
3、进入nginx源码目录
cd nginx-1.10.2
4、重新编译的代码和模块
./configure --prefix=/usr/local/nginx --with-http_ssl_module
5、执行 make (注意:千万别 make install ,否则就覆盖安装了), make完之后在/software/nginx-1.10.2/objs目录下就多了个nginx,这个就是新版本的程序了。
6、备份旧的nginx程序
cd /usr/local/nginx/sbin/ mv nginx nginx_bak
7、把新的nginx程序复制到/usr/local/nginx/sbin/下
cp /software/nginx-1.10.2/objs/nginx /usr/local/nginx/sbin/
8、测试新的nginx程序是否正确
/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
9、平滑启动服务
/usr/local/nginx/sbin/nginx -s reload
查看模块是否已安装
/usr/local/nginx/sbin/nginx -V nginx version: nginx/1.10.2 built by gcc 4.8.5 20150623 (Red Hat 4.8.5-4) (GCC) built with OpenSSL 1.0.1e-fips 11 Feb 2013 TLS SNI support enabled configure arguments: --prefix=/usr/local/nginx --with-http_ssl_module
重启Nginx
./nginx -s quit ./nginx
nginx重新加载模块完成!
相关推荐
nginxs 2020-11-14
Guanjs0 2020-11-13
小木兮子 2020-11-11
yserver 2020-11-11
ssihc0 2020-11-11
windle 2020-11-10
HanksWang 2020-11-10
liuchen0 2020-11-10
Freshairx 2020-11-10
ccschan 2020-11-10
liwf 2020-11-10
Guanjs0 2020-11-09
AderStep 2020-11-09
zrtlin 2020-11-09
mqfcu 2020-11-10
windle 2020-10-29