我需要将client.mysite.com重定向到https,而client.mysite.com/admin应保留http。如何在nginx Web服务器上实现这一目标?
现在我将它用于子域名,但也重定向client.mysite.com/admin:
server {
listen 80;
server_name my.domain.com;
rewrite ^ https://$server_name$request_uri? permanent;
}
答案 0 :(得分:1)
您需要仅在location /
server {
listen 80;
server_name sub.example.com;
location = / {
return 301 https://example2.com$request_uri;
}
location / {
# remaining rules
}
}