Hi all,
My environment : Centos 6.9 + rh-nginx18-nginx-1.8.1-1.el6.x86_64 .
I have wildcard certificate for domain *.mydomain.com , server accepts both http and https requests
[code]
server {
listen 192.168.0.19:80; # we serve both http and https
listen 192.168.0.19:443 default_server ssl;
server_name *.mydomain.com;
ssl_certificate
ssl_certificate_key
...
proxy_pass http://upstreams; we pass request to upstream based on some url conditions
}
[/code]
Now if I want to force redirect http to https for only 1 specific domain abc.mydomain.com and leave the rest remains the same, what should I do ?
I tried :
[code]
server {
listen 192.168.0.19:80;
server_name abc.mydomain.com;
return 301 https://$host$request_uri;
}
server {
listen 192.168.0.19:80; # we serve both http and https
listen 192.168.0.19:443 default_server ssl;
server_name *.mydomain.com;
ssl_certificate
ssl_certificate_key
...
proxy_pass http://upstreams; we pass request to upstream based on some url conditions
}
[/code]
But it doesn't work.
Please give me some advice, thank you very much.
My environment : Centos 6.9 + rh-nginx18-nginx-1.8.1-1.el6.x86_64 .
I have wildcard certificate for domain *.mydomain.com , server accepts both http and https requests
[code]
server {
listen 192.168.0.19:80; # we serve both http and https
listen 192.168.0.19:443 default_server ssl;
server_name *.mydomain.com;
ssl_certificate
ssl_certificate_key
...
proxy_pass http://upstreams; we pass request to upstream based on some url conditions
}
[/code]
Now if I want to force redirect http to https for only 1 specific domain abc.mydomain.com and leave the rest remains the same, what should I do ?
I tried :
[code]
server {
listen 192.168.0.19:80;
server_name abc.mydomain.com;
return 301 https://$host$request_uri;
}
server {
listen 192.168.0.19:80; # we serve both http and https
listen 192.168.0.19:443 default_server ssl;
server_name *.mydomain.com;
ssl_certificate
ssl_certificate_key
...
proxy_pass http://upstreams; we pass request to upstream based on some url conditions
}
[/code]
But it doesn't work.
Please give me some advice, thank you very much.