1

I have the following configuration that works for http:

server {
    listen 80;
    listen [::]:80;

    server_name subdomain.domain.tech;

    location / {
        proxy_set_header   X-Forwarded-For $remote_addr;
        proxy_set_header   Host $http_host;
        proxy_pass         "http://127.0.0.1:1337";
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_cache_bypass $http_upgrade;
    }
}

I I try to do it with https and access to https://subdomain.domain.tech I have infinite loading with not error on nginx. Https config:

server {
    listen 443 ssl;
    server_name subdomain.domain.tech;

    ssl on;
    ssl_certificate /etc/letsencrypt/live/subdomain.domain.tech/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/subdomain.domain.tech/privkey.pem;

    ssl_session_timeout  5m;
    ssl_protocols  SSLv2 SSLv3 TLSv1;
    ssl_ciphers  ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;
    ssl_prefer_server_ciphers   on;

    access_log /var/log/nginx/access.log postdata;

    location / {
        proxy_set_header   X-Forwarded-For $remote_addr;
        proxy_set_header   Host $http_host;
        proxy_pass         "http://127.0.0.1:1337";
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_cache_bypass $http_upgrade;
    }
}

I also tried to remove the http part and redirect to https if I enter an http url:

server {
   listen 80;
   listen [::]:80;
   server_name subdomain.domain.tech;
   return 301 https://subdomain.domain.tech$request_uri;
}

I've also verified that the certificate are there. But this is obvious because I don't receive any error from nginx.

Any idea why it does not work? Thank you

1

1 Answer 1

0

Obviously was a stupid thing. As I was using Amazon AWS EC2 I forgot to open the port in the Amazon firewall. After allowing traffic on port 443 everything works fine ;)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .