Welcome! Log In Create A New Profile

Advanced

301 from domain https to subdomain https

Posted by toomany 
301 from domain https to subdomain https
September 18, 2015 05:10AM
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,
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 121
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready