Baraque Obahamas
Baraque Obahamas

Reputation: 73

Nginx - redirect www to https : ERR_SSL_PROTOCOL_ERROR

I tried to copy the configuration file of my other website but it doesn't work for it, maybe because I have a proxy on it ? I really don't know what's the problem. https://mywebsite.lol is ok (SSL by cloudflare)

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;
    }

}

Upvotes: 4

Views: 18104

Answers (1)

Max Ivanov
Max Ivanov

Reputation: 61

Use HTTPS port, not HTTP. It should be

listen 443;

instead of

listen 80;

Upvotes: 1

Related Questions