Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bad certificate for www.avored.com #485

Open
lhsazevedo opened this issue Oct 3, 2020 · 2 comments
Open

Bad certificate for www.avored.com #485

lhsazevedo opened this issue Oct 3, 2020 · 2 comments

Comments

@lhsazevedo
Copy link
Contributor

The SSL certificate served at www.avored.com is only valid for avored.com (without www), thus, a user browsing the former is presented with an warning like this:

Screenshot from 2020-10-03 11-44-57

Possible solution

Install a valid certificate for www.avored.com
Bonus: Redirect all www requests to non-www (or the other way around)

@indpurvesh
Copy link
Member

@lhsazevedo
Now the idea was that just to use the domain name itself and it should redirect if you are trying to access www.avored.com => avored.com

I will double check the nginx.conf file.

@lhsazevedo
Copy link
Contributor Author

I think a valid certificate is still needed to stabilish a connection on the https/www domain and redirect to https/non-www one

Here's a simplified copy of a nginx.conf i'm running right now:

server {
    server_name www.mydomain.example;

    # ...

    listen 443 ssl; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/mydomain.example-0001/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/mydomain.example-0001/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
}

# Redirect https to https+www
server {
    listen 443 ssl http2;
    server_name mydomain.example;

    return 301 https://www.mydomain.example$request_uri;

    ssl_certificate /etc/letsencrypt/live/mydomain.example-0001/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/mydomain.example-0001/privkey.pem; # managed by Certbot
}

# Redirect http+www to https+www
server {
    if ($host = www.mydomain.example) {
        return 301 https://$host$request_uri;
    } # managed by Certbot

    server_name www.mydomain.example;
    listen 80;
    return 404; # managed by Certbot
}

# Redirect http to https+www 
server {
    if ($host = mydomain.example) {
        return 301 https://$host$request_uri;
    } # managed by Certbot

    server_name mydomain.example;
    listen 80;
    return 404; # managed by Certbot
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants