【问题标题】:NGINX Configure HttpsNGINX 配置 Https
【发布时间】:2016-05-26 10:42:39
【问题描述】:

我正在尝试在 http 和 https 上运行我的应用程序。该应用程序呈现静态 html 以及它们的 css' 和 js'。我使用 nginx 来提供页面。我已经配置了我的 nginx 配置,但是页面没有在 https 上呈现。

当我点击http://subdomain.example.com 时,效果很好!

但是,当我点击 https://subdomain.example.com 时,Chrome 中会出现 CONNECTION_RESET 或 CONNECTION_CLOSED 错误。

下面是我的配置:

    server {
    listen       80;
    server_name  subdomain.example.com;

    #charset koi8-r;
    #access_log  /var/log/nginx/log/host.access.log  main;

    location / {
        root   /var/www/html/htmls/;
        index  entergmat.html;
    }
}

server{
    listen              443 ssl;
    ssl                 on;
    server_name         subdomain.example.com;
    ssl_certificate     /path/to/certificate.crt;
    ssl_certificate_key /path/to/certificate.key;
#   ssl_protocols       TLSv1 TLSv1.1 TLSv1.2;
#   ssl_ciphers         HIGH:!aNULL:!MD5;
    keepalive_timeout   70;

    location / {
        root   /var/www/html/htmls/;
        index  entergmat.html;
    }
}

请求您的帮助。

谢谢!

【问题讨论】:

    标签: nginx https


    【解决方案1】:

    我建议从您的配置中删除 ssl on;

    建议使用listen指令的ssl参数 而不是这个指令。

    来自 nginx 文档http://nginx.org/en/docs/http/ngx_http_ssl_module.html#ssl

    【讨论】:

    • 也试过了,还是不行。
    • 您在创建证书时是否提供了正确的站点域?
    猜你喜欢
    • 2017-08-03
    • 1970-01-01
    • 2016-08-23
    • 2017-06-08
    • 1970-01-01
    • 2016-04-30
    • 2017-03-23
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多