nginx redirection is not working as expected with ssl and www redirection.
I have two domains say, domain1.com and domain2.com. I need to have https with www redirection on both ie https:/www.domain1.com. and https:/www.domain2.com.
but when i take www.domain2.com its redirected to https:/www.domain1.com.
Please see the configurations
domain1.com
server {
listen 8080;
server_name domain1.com;
return 301 https://www.domain1.com$request_uri;
}
server {
listen 443 default_server;
ssl on;
ssl_certificate /root/ssl/dom1/unified.crt;
ssl_certificate_key /root/ssl/dom1/my-private-decrypted.key;
root /var/www/dom1.com/html;
index index.php index.html index.htm;
server_name www.domain1.com;
}
domain2.com
server {
listen 8080;
server_name domain2.com;
return 301 https://www.domain2.com$request_uri;
}
server {
listen 443;
ssl on;
ssl_certificate /root/ssl/dom2/unified.crt;
ssl_certificate_key /root/ssl/dom2/my-private-decrypted.key;
root /var/www/dom2.com/html;
index index.php index.html index.htm;
server_name www.domain2.com;
}
Comments
Post a Comment