I\'m setting up an nginx server with an SSL.
The domain with the ssl is www.mydomain.com
I want to redirect all requests from:
http://mydomain.com, h
I am late, But you can do like this
server{
listen 443 ssl;
server_name www.mydomain.com;
root /www/mydomain.com/;
ssl on;
ssl_certificate /ssl/domain.crt;
ssl_certificate /ssl/domain.key;
.
.
.
}
server{
listen 80;
server_name www.mydomain.com mydomain.com;
return 301 https://$server_name$request_uri;
}
server{
listen 443;
server_name mydomain.com;
return 301 https://www.$server_name$request_uri;
}
Or you can replace return 301 https://www.$server_name$request_uri;
with rewrite ^ http://www.$server_name$request_uri? permanent;
, both will work.
You also need to set this in google webmaster for better SEO.