【问题标题】:Nginx - redirect www to https : ERR_SSL_PROTOCOL_ERRORNginx - 将 www 重定向到 https:ERR_SSL_PROTOCOL_ERROR
【发布时间】:2015-11-12 03:16:39
【问题描述】:

我试图复制我其他网站的配置文件,但它不起作用,可能是因为我有代理?我真的不知道有什么问题。 https://mywebsite.lol 可以(cloudflare 的 SSL)

server {
    server_name     www.irc.mywebsite.lol;
    rewrite ^(.*)   https://irc.mywebsite.lol$1 permanent;
}


server {
    # Port
    listen 80;

    # Hostname
    server_name irc.mywebsite.lol;

    # Logs (acces et erreurs)
    access_log /var/log/nginx/irc.mywebsite.lol.access.log;
    error_log /var/log/nginx/irc.mywebsite.lol.error.log;

     location / {
            proxy_set_header Host $host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header x-forwarded-for $proxy_add_x_forwarded_for;

            proxy_pass http://localhost:7778/;
            proxy_redirect default;

            # Websocket support (from version 1.4)
            proxy_http_version 1.1;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection "upgrade";

            pagespeed off;
    }

}

【问题讨论】:

    标签: redirect nginx https


    【解决方案1】:

    使用 HTTPS 端口,而不是 HTTP。应该是

    listen 443;
    

    而不是

    listen 80;
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-01-07
      • 2018-06-23
      • 2020-12-31
      • 1970-01-01
      • 2017-03-10
      相关资源
      最近更新 更多