美文网首页
nginx: [emerg] the “ssl“ paramet

nginx: [emerg] the “ssl“ paramet

作者: jeffrey_hjf | 来源:发表于2022-03-20 21:59 被阅读0次

    背景
    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 模块安装成功:


    image.png

    相关文章

      网友评论

          本文标题:nginx: [emerg] the “ssl“ paramet

          本文链接:https://www.haomeiwen.com/subject/epgadrtx.html