nginx关于配置SSL后启动失败原因分析

在配置SSL后,启动./nginx失败,报错提示如下:

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

        这个错误提示表在配置nginx启用SSL时,nginx未启用 ngx_http_ssl_module 模块,因此无法使用 ssl 参数。

   ngx_http_ssl_module 是一个必须的模块,提供了 SSL 和 TLS 支持。要解决这个问题,你需要确保在编译 nginx 时启用了 ngx_http_ssl_module

解决方法:

1、检查 Nginx 是否启用了 SSL 模块

        检查 Nginx 是否已经启用了 ngx_http_ssl_module 模块。切换到sbin目录下,通过以下命令查看 Nginx 的编译配置:

./nginx -V

        输出的内容中,应该包含 --with-http_ssl_module,如果没有,说明 Nginx 编译时没有启用 SSL 模块。

2、检测是否安装了OpenSSL,执行命令:

openssl version

安装显示结果:

 如果没有安装,则下载安装包进行安装,这里不详述了。

3、重新编译 Nginx 启用 ngx_http_ssl_module

切换到nginx目录执行命令:

./configure --with-http_ssl_module --prefix=/usr/local/nginx-1.27.4

make
sudo make install

执行完再次检查是否安装成功:

有configure arguments: --with-http_ssl_module --prefix=/usr/local/nginx-1.27.4 则表示已经安装成功,并启用了SSL

现在再启动nginx就成功了

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值