nginx编译ssl模块


很多年前几个官网在一台服务器上面,其中一台是https的,业务需要增加一个官网,重启nginx以后,https的网站直接报错,大意是ssl 在配置文件中unknow,但是这个https网站已经运行很久了,一时间有点郁闷,掉坑里了。

查看nginx信息 /usr/local/nginx/sbin/nginx -V显示不支持ssl,那就好办,重新编译下ssl,但是线上业务跑着,为了业务稳健,先在测试机上编译测试正常以后,到线上操作,大致如下:

进入nginx源码目录:

cd  nginx-1.6.2

./configure –prefix=/usr/local/nginx –user=www –group=www  –with-http_stub_status_module –with-http_ssl_module –with-file-aio –with-http_realip_module

只添加ssl功能模块,有别的需求继续加上;

运行完以后记得是make,make,make不是make & make install ,install就覆盖安装了,千万搞清楚~

make以后在当前目录生成odjs目录,下面就是新的nginx;

剩下就好办,备份原来的nginx,把新生成的nginx替换原来的,

备份旧的nginx程序

cp /usr/local/nginx/sbin/nginx/usr/local/nginx/sbin/nginx.bak

把新的nginx程序覆盖旧的

cp objs/nginx /usr/local/nginx/sbin/nginx

测试新的nginx程序是否正确

/usr/local/nginx/sbin/nginx -t

nginx: theconfiguration file /usr/local/nginx/conf/nginx.conf syntax is ok

nginx:configuration file /usr/local/nginx/conf/nginx.conf test issuccessful

平滑重启nginx

/usr/local/nginx/sbin/nginx -s reload

查看ngixn版本极其编译参数

/usr/local/nginx/sbin/nginx -V

configure arguments: –prefix=/data/app/nginx –user=www –group=www –with-http_stub_status_module –with-http_ssl_module –with-file-aio –with-http_realip_module

权作一个笔记。


文章作者: 云上的小雨滴
版权声明: 本博客所有文章除特別声明外,均采用 CC BY 4.0 许可协议。转载请注明来源 云上的小雨滴 !
评论
  目录