nginx

关注公众号 jb51net

关闭
首页 > 网站技巧 > 服务器 > nginx > Nginx安装SSl模板异常处理

Nginx安装SSl模板异常处理方式

作者:不吃水的鱼ヾ(・ω・`。)

文章介绍了在Linux环境下配置Nginx支持SSL时遇到的问题及解决方法,主要步骤包括:安装SSL模块、解决缺少OpenSSL包的问题,并通过下载和编译源码的方式解决SSL模块安装失败的问题

前言

web服务需要支持https 就需要配置Nginx支持ssl,中间可能会遇到一些困难点,本文就介绍了我在linux环境下配置环境的一些异常。

一、配置Nginx支持ssl

   server {
        listen       443 ssl;
        server_name  localhost;
 
        ssl_certificate      cert.pem;
        ssl_certificate_key  cert.key;
 
    #    ssl_session_cache    shared:SSL:1m;
    #    ssl_session_timeout  5m;
 
    #    ssl_ciphers  HIGH:!aNULL:!MD5;
    #    ssl_prefer_server_ciphers  on;
 
        location / {
            root   html;
            index  index.html index.htm;
        }
   }

二、重启Nginx

进入sbin目录

重新加载∶/nginx-s reload

三、发现报错异常

nginx: [emerg] unknown directive “ssl” in /usr/local/nginx/conf/nginx.conf

1.分析是缺少ssl模块

2.开始安装ssl模块

3.到nginx 文件目录中进行安装

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

四、发现报错异常

./configure: error: SSL modules require the OpenSSL library

1.分析是缺少OpenSSL包

2.openssl version 命令发现本机安装了openSSl

2.由于我的是无网环境

3.解压tar -xvzf openssl-1.0.2l.tar.gz

./configure --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-openssl=/usr/local/openssl

4.上面的with-openssl我填的是解压后文件的路径,然后安装成功,直接安装OpenSSL 在我的Linux环境下是安装失败的。

5.make 一下

总结

以上为个人经验,希望能给大家一个参考,也希望大家多多支持脚本之家。

您可能感兴趣的文章:
阅读全文