Hi!
I'm looking for any information about how to do a 301 from a https domian to a https subdomain. We've got the certificates for the www.somedomain.com, but not for the somedomain.com. The redirects from http://domain.com --> https://www.domain.com are running like a charm without any problem. The problem is when I define a listen 443 like this:
https://domain.com ---> https://www.domain.com (remember that we don't have any cert for domain; only for subdomain)
This is the configuration for the file "vhost-domain.com.conf":
server {
listen 80;
server_name domain.com;
return 301 https://www.domain.com;
}
server {
listen 80;
server_name www.domain.com;
return 301 https://www.domain.com;
}
server {
listen 443;
ssl_certificate /dir/nginx/lookforssl/mycrt.crt;
ssl_certificate_key /dir/nginx/lookforssl/mykey.key;
keepalive_timeout 70;
server_name domain.com;
return 301 https://www.domain.com;
}
server {
ssl on;
ssl_certificate /dir/nginx/lookforssl/mycrt.crt;
ssl_certificate_key /dir/nginx/lookforssl/mykey.key;
keepalive_timeout 70;
listen 443 ssl;
server_name www.domain.com;
# access_log /var/log/nginx/domain.com_access.log combined;
access_log off;
error_log /var/log/nginx/domain.com_error.log error;
log_not_found off;
.... rest of config...
Thank you so much for your help.
Best regards,
I'm looking for any information about how to do a 301 from a https domian to a https subdomain. We've got the certificates for the www.somedomain.com, but not for the somedomain.com. The redirects from http://domain.com --> https://www.domain.com are running like a charm without any problem. The problem is when I define a listen 443 like this:
https://domain.com ---> https://www.domain.com (remember that we don't have any cert for domain; only for subdomain)
This is the configuration for the file "vhost-domain.com.conf":
server {
listen 80;
server_name domain.com;
return 301 https://www.domain.com;
}
server {
listen 80;
server_name www.domain.com;
return 301 https://www.domain.com;
}
server {
listen 443;
ssl_certificate /dir/nginx/lookforssl/mycrt.crt;
ssl_certificate_key /dir/nginx/lookforssl/mykey.key;
keepalive_timeout 70;
server_name domain.com;
return 301 https://www.domain.com;
}
server {
ssl on;
ssl_certificate /dir/nginx/lookforssl/mycrt.crt;
ssl_certificate_key /dir/nginx/lookforssl/mykey.key;
keepalive_timeout 70;
listen 443 ssl;
server_name www.domain.com;
# access_log /var/log/nginx/domain.com_access.log combined;
access_log off;
error_log /var/log/nginx/domain.com_error.log error;
log_not_found off;
.... rest of config...
Thank you so much for your help.
Best regards,