Welcome! Log In Create A New Profile

Advanced

1 certificate for domain.com but 2 declared domains : domain.com and domain.fr

Posted by gperrot 
1 certificate for domain.com but 2 declared domains : domain.com and domain.fr
June 01, 2022 11:16AM
Hello,

I have a nginx server working for https://www.domain.com with certificates for domain.com.

server {
server_name domain.com www.domain.com;
listen <IP>:443 ssl;
ssl_certificate <certificate>
ssl_certificate_key <certificate_key>
...
}

Now, I would like to redirect all request to https://www.domain.fr to https://www.domain.com but I don't want to have certificates for domain.fr. I added those conf lines :

server {
listen 80;
listen 443;
server_name domain.fr www.domain.fr;

return 301 $scheme://easycrypt.io$request_uri;
}

The problem is that when I use https://www.domain.fr, my browser that the site is not secured, probably because I don't have certificate for domain.fr. No way to avoid to have certificate for domain.fr ?

Thanks in advance for your help.

Gilles
Hi,

I finally corrected my conf file by the following lines and it works. No way to use only the certificate for domain.com for domain.fr HTTPs requests since redirection ?

Thanks in advance for your help.

Gilles.

======================

server {
listen 212.129.28.201:80;
server_name www.domain.com domain.com www.domain.fr domain.fr ;
return 301 https://easycrypt.io$request_uri;
}

server {
server_name domain.com www.domain.com;
listen <IP>:443 ssl;
ssl_certificate <certificate for domain.com>
ssl_certificate_key <certificate_key for domain.com>
...
}

server {
server_name domain.fr www.domain.fr;
listen <IP>:443 ssl;

ssl_certificate <certificate for domain.fr>
ssl_certificate_key <certificate_key for domain.fr>

return 301 https://easycrypt.io$request_uri;
}
Other question : how can I modify my conf file in order to redirect https://www.domain.com to https://domain.com ?

Thanks in advance for your help.

Gilles
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 265
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready