Welcome! Log In Create A New Profile

Advanced

Multiple https website with IPv6

January 02, 2018 01:40AM
I am using nginx with multiples https with a single IPv4 and dedicated IPv6 for each domain.

The problem i'm having is i'm unable to redirect non www to www without conflicting with the vhosts.

Here my setup

[b]Default[/b]

[code]
server {
listen 80 default_server;
listen [::2]:80 default_server;
server_name localhost;
}
[/code]

[b]domain[/b]

[code]
server {
listen 80;
listen [::2]:80;
server_name domain.com www.domain.com;
return 301 https://www.domain.com$request_uri;
}

server {
listen 443 ssl http2;
listen [::2]:443 ssl http2;
server_name domain.com;
return 301 https://www.$server_name$request_uri;
}

server {
listen 443 default_server ssl http2;
listen [::2]:443 default_server ssl http2;
server_name www.domain.com;
}
[/code]

[b]domain 2[/b]

[code]
server {
listen 80;
listen [::3]:80;
server_name domain2.com www.domain2.com;
return 301 https://www.domain2.com$request_uri;
}

server {
listen 443 ssl http2;
listen [::3]:443 ssl http2;
server_name domain2.com;
return 301 https://www.$server_name$request_uri;
}

server {
listen 443 ssl http2;
listen [::3]:443 default_server ssl http2;
server_name www.domain2.com;
}
[/code]

So here's the problem

IPv4

https://www.domain.com ✔
https://domain.com ✔

http://www.domain.com ✔
http://domain.com ✔

https://www.domain2.com ✔
https://domain2.com ✗(NET::ERR_CERT_COMMON_NAME_INVALID - domain.com)

http://www.domain2.com ✔
http://domain2.com ✔

IPv6

https://www.domain.com ✔
https://domain.com ✔

http://www.domain.com ✔
http://domain.com ✔

https://www.domain2.com ✔
https://domain2.com ✔

http://www.domain2.com ✔
http://domain2.com ✔

In IPv4 domain (https://domain2.com) the certificate of domain.com is served.

What's wrong with my config? If work on IPv6 why not in IPv4 is in same config block?
Subject Author Posted

Multiple https website with IPv6

Kurogane January 02, 2018 01:40AM

Re: Multiple https website with IPv6

Francis Daly January 02, 2018 06:04AM

Re: how do I run multiple https web sites on a single IP address

Kurogane January 02, 2018 11:27AM

Re: how do I run multiple https web sites on a single IP address

Valentin V. Bartenev January 02, 2018 11:36AM

Re: how do I run multiple https web sites on a single IP address

Francis Daly January 02, 2018 05:56PM

Re: how do I run multiple https web sites on a single IP address

Kurogane January 03, 2018 02:23PM

Re: how do I run multiple https web sites on a single IP address

Francis Daly January 03, 2018 05:40PM

Re: how do I run multiple https web sites on a single IP address

Kurogane January 04, 2018 07:19PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 192
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