分类: Linux
Nginx: [emerg] the "ssl" parameter requires ngx_http_ssl_module in nginx.conf解决之热更新

Nginx如果未开启SSL模块,配置Https时提示错误

nginx: [emerg] the "ssl" parameter requires ngx_http_ssl_module in /usr/local/nginx/conf/nginx.conf

是因为nginx缺少http_ssl_module模块,编译安装的时候带上--with-http_ssl_module参数
Nginx开启SSL模块步骤:
安装openssl支持

yum install openssl openssl-devel -y

查看nginx原有的模块

/usr/local/nginx/sbin/nginx -V
nginx version: nginx/1.14.0
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-28) (GCC) 
TLS SNI support enabled
configure arguments: --prefix=/usr/local/nginx 
增加--with-http_ssl_module参数

/usr/local/nginx/sbin/nginx --prefix=/usr/local/nginx --with-http_ssl_module
make
这里不要进行make install,否则就是覆盖安装
备份原有已安装好的nginx

mv /usr/local/nginx/sbin/nginx /usr/local/nginx/sbin/nginx.bak
复制源码目录下的 objs/nginx 覆盖/usr/local/nginx/sbin/nginx

cp ./objs/nginx /usr/local/nginx/sbin/
对新安装的进行语法测试,显示successfully表示成功

/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
重启nginx

/usr/local/nginx/sbin/nginx -s reload  重新加载,实现平滑升级

查看是否已经加入成功新编译的参数:

/usr/local/nginx/sbin/nginx -V
nginx version: nginx/1.14.0
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-28) (GCC) 
built with OpenSSL 1.0.2k-fips  26 Jan 2017
TLS SNI support enabled
configure arguments: --prefix=/usr/local/nginx --with-zlib=/opt/zlib-1.2.11 --with-pcre=/opt/pcre-8.42 --with-http_stub_status_module --with-http_realip_module --with-http_gzip_static_module --with-http_ssl_module


相关博文:

发表新评论