0

I have a server with nginx, and there are two websites there: A and B.

Site A is an old one and it's been working with SSL certificate Let's Encrypt via certbot package and command.

Tonight I decided to add a new website and obtain SSL for it too.

Certificate is obtained successfully and the website B is working with valid SSL.

But when I enter doaminA.com, I got an error in google chrome:

example.com normally uses encryption to protect your information. When Google Chrome tried to connect to example.com this time, the website sent back unusual and incorrect credentials. This may happen when an attacker is trying to pretend to be example.com, or a Wi-Fi sign-in screen has interrupted the connection. Your information is still secure because Google Chrome stopped the connection before any data was exchanged.

You cannot visit example.com right now because the website uses HSTS. Network errors and attacks are usually temporary, so this page will probably work later.

I dug into this more and figured out a Not Secure error left side of my domain name in google chrome. I clicked on that to see the certificates, I saw:

Issued to: domain_b.com

Issued By: R3

Date: ...

I should note that I checked both certificates at /etc/letsencrypt/live/domain_name/ and cert files are valid and there are no problem with them.

How should I solve the problem for domain A?

4
  • 1
    are both sites on the same public ip? if so, have you set up for SNI? not sure how to do it in nginx, but it involves setting each site to a domain name in its server config. SNI allows you to host two https sites on the same IP, by using the domain name to determine which site to route to. it sounds like you site b is the default site, so it tries to negotiate the https connection instead of A. stackoverflow.com/questions/43290153/… Commented Jun 18, 2021 at 4:31
  • @FrankThomas yes they both are on the same public IP. No, I did not set any SNI. Now I have removed the site B's certificates and stopped it, my site A is working fine. I also read the answer you linked but it does not help me
    – Saeed
    Commented Jun 18, 2021 at 10:21
  • 1
    Ok,, well, in order to set up multiple https sites on the same IP using different certificates, you do need Server Name Identification {SNI) supported and correctly configured. I'm sorry I cannot provide more specific advice on nginx, but i do recommend you focus your research there. SNI adds a header to the https segment that contains the host and domain name associated with the request in an unencrypted form. that way the server can identify the correct site without yet knowing which certificate it will need to use to establish the HTTPS connection Commented Jun 19, 2021 at 2:22
  • @FrankThomas thanks, the question is solved via another question
    – Saeed
    Commented Jun 19, 2021 at 10:56

1 Answer 1

1

As mentioned here, I should have added server_name directive for ssl block.

You must log in to answer this question.

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