背景
Nginx 配置了 HTTPS ,启动报错:nginx: [emerg] the "ssl" parameter requires ngx_http_ssl_module in /usr/local/nginx/conf/nginx.conf:42
1
提示 Nginx 缺少 http_ssl_module 模块。
解决
查看现有模块
nginx -V
configure arguments: --prefix=/usr/local/nginx --pid-path=/var/run/nginx/nginx.pid --lock-path=/var/lock/nginx.lock --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --with-http_gzip_static_module --http-client-body-temp-path=/var/temp/nginx/client --http-proxy-temp-path=/var/temp/nginx/proxy --http-fastcgi-temp-path=/var/temp/nginx/fastcgi --http-uwsgi-temp-path=/var/temp/nginx/uwsgi --http-scgi-temp-path=/var/temp/nginx/scgi --add-module=/root/FastDFS/fastdfs-nginx-module/src
的确 没有 http_ssl_module 模块。。
添加SSL模块
# 进入Nginx源码目录 cd /root/FastDFS/nginx-1.12.2 # 附加--with-http_ssl_module ./configure --prefix=/usr/local/nginx --pid-path=/var/run/nginx/nginx.pid --lock-path=/var/lock/nginx.lock --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --with-http_gzip_static_module --http-client-body-temp-path=/var/temp/nginx/client --http-proxy-temp-path=/var/temp/nginx/proxy --http-fastcgi-temp-path=/var/temp/nginx/fastcgi --http-uwsgi-temp-path=/var/temp/nginx/uwsgi --http-scgi-temp-path=/var/temp/nginx/scgi --add-module=/root/FastDFS/fastdfs-nginx-module/src --with-http_ssl_module # 运行make命令 make # 备份 cp /usr/local/nginx/sbin/nginx /usr/local/nginx/sbin/nginx.bak # 停止 nginx -s stop # 保证nginx是关闭状态, 如果无法关闭,可以使用杀死进程方式关闭 ps -ef | grep nginx # 强制退出: pkill -9 nginx # 新编译的Nginx覆盖原来的Nginx cp ./objs/nginx /usr/local/nginx/sbin/ # 启动Nginx nginx # 再次查看已安装模块,确认是否成功 nginx -V # 相关命令 ./nginx -s reload ./nginx -s stop ./nginx
http_ssl_module 模块安装成功:
![nginx: [emerg] the “ssl“ parameter requires ngx_http_ssl_module in /usr/local/nginx/conf/nginx.conf](https://pic.songma.com/blogimg/20251024/d9fe824b72624ed788b1dd01dc0e7f68.jpg)