问题:nginx部署SSL证书后重启nginx,报如下错误:
nginx: [emerg] the "ssl" parameter requires ngx_http_ssl_module in /usr/local/nginx/conf/nginx.conf:46
分析:
原因:nginx缺少http_ssl_module模块,编译安装的时候带上–with-http_ssl_module配置就行了
nginx安装目录: /usr/local/nginx/
nginx源码目录: /data/nginx-1.24.0/
查看是否开启ssl模块
[root@YMYSZ-1 sbin]# ./nginx -V
nginx version: nginx/1.24.0
built by gcc 7.3.0 (GCC)
configure arguments:
configure arguments:
此部分没有ssl模块信息
处理:开启ssl模块
注:处理前先关闭nginx: nginx -s stop
1. 切换到源码目录
cd /data/nginx-1.24.0
2. 执行命令
./configure --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module
3. 编译 (这里不要进行make install,否则就是覆盖安装)
make
4. 备份原来nginx配置文件
cp /usr/local/nginx/sbin/nginx /usr/local/nginx/sbin/nginx.bak
5. 将刚生成的配置覆盖原来的配置
cp ./objs/nginx /usr/local/nginx/sbin/
6. 启动nginx
cd /usr/local/nginx/sbin
启动
./nginx
再次查看是否开启ssl模块
[root@YMYSZ-1 sbin]# ./nginx -V
nginx version: nginx/1.24.0
built by gcc 7.3.0 (GCC)
built with OpenSSL 1.1.1-pre2 (alpha) 27 Feb 2018 (running with OpenSSL 1.1.1f 31 Mar 2020)
TLS SNI support enabled
configure arguments: --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module
已开启,可以重新启动nginx