Https redirecting to gitlab signin

Please fill out the fields below so we can help you better. Note: you must provide your domain name to get help. Domain names for issued certificates are all made public in Certificate Transparency logs (e.g. crt.sh | example.com), so withholding your domain name here does not increase secrecy, but only makes it harder for us to provide help.

My domain is: dmssilver6.com

I have enabled ssl in my domain. Here is my config after i ran the certbot command:

server {
    server_name dmssilver6.com www.dmssilver6.com;
    root /root/silver6-frontend/dist;
    location / {
        try_files $uri $uri/ =404;
    }

    listen 465 ssl; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/dmssilver6.com/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/dmssilver6.com/privkey.pem; # managed by Certbot
    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}
server {
    if ($host = www.dmssilver6.com) {
        return 301 https://$host$request_uri;
    } # managed by Certbot


    if ($host = dmssilver6.com) {
        return 301 https://$host$request_uri;
    } # managed by Certbot

    return 404; # managed by Certbot
}
server {
    if ($host = www.dmssilver6.com) {
        return 301 https://$host$request_uri;
    } # managed by Certbot

    if ($host = dmssilver6.com) {
        return 301 https://$host$request_uri;
    } # managed by Certbot

    listen 80;
    server_name dmssilver6.com www.dmssilver6.com;
    return 404; # managed by Certbot
}

It says site is not secured and my sites doesnot opens.
Because of that i have removed some part of the code and have used only:

server {
     listen 80;
    server_name dmssilver6.com www.dmssilver6.com;
    root /root/silver6-frontend/dist;
    location / {
        try_files $uri $uri/ =404;
    }

    listen 465 ssl; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/dmssilver6.com/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/dmssilver6.com/privkey.pem; # managed by Certbot
    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}

it opens the unsecured (http) site. What's wronng with the config?

Why are you listening on port 465 rather than 443 in your server block for HTTPS? HTTPS to port 465 is working fine but HTTPS to port 443 is failing.

The default port for HTTPS is 443 so when browsers try that they get some other config and not the one you show above.

Also, your revised server block combining port 80 and 465 (or even 443) will be difficult to get to work correctly. You should resume using the original two server blocks but change the listen to 443 (from 465) unless there are some unusual circumstances. Please explain if this applies to you.

See this testing tool for these port tests for HTTPS

3 Likes

if i use port 443. nginx will not start and gives port already on use.