Nginx - 将www重定向到https:ERR_SSL_PROTOCOL_ERROR

时间:2015-08-19 01:20:49

标签: redirect nginx https

我试图复制我的其他网站的配置文件,但它不起作用,可能是因为我有代理吗?我真的不知道问题是什么。 https://mywebsite.lol没问题(SSL炫耀的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;
    }

}

1 个答案:

答案 0 :(得分:1)

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

listen 443;

而不是

listen 80;