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

SSL相关的配置加到了nginx的配置文件中后,nginx竟然启动不起来了

于是用如下命令测试问题所在:

/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf

其中,/usr/local/nginx/sbin/nginx 是我的nginx安装后的可执行程序路径,/usr/local/nginx/conf/nginx.conf 是我的nginx主配置文件路径。

该命令输出如下:

可见,nginx缺少SSL模块支持。所以以前编译nginx的时候使用了不带SSL支持的默认编译参数。
为了让nginx添加SSL模块,只能重新编译它。但是,如何在现有nginx的基础上,添加一个支持SSL的编译参数呢?首先要找回原来编译nginx时的编译参数,然后再加上支持SSL的编译参数。如果不这样做,那么编译出来的nginx可能就会有问题(某些旧的编译参数被去掉了,使得nginx不能支持某些功能)。

先查看旧的nginx的编译参数:

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

 

可见,当时我编译nginx的时候,没有加ssl参数 ,那么现在事情就好办了:回到nginx的源码目录下,加上SSL支持参数重新编译:

./configure --prefix=/usr/local/nginx --with-http_realip_module --with-http_image_filter_module=dynamic --with-http_ssl_module

make

注意:编译时nginx进程关闭

原文地址:https://www.cnblogs.com/pipiyan/p/10784484.html