【发布时间】:2017-06-09 07:49:58
【问题描述】:
我目前在使用 nginx 重定向到另一台主机时遇到了一个小问题。例如,我想将 https://service.company.com/new/test.html 重定向到 https://new-service.company.com/test.html 。
现在我有以下配置,将我重定向到https://new-service.company.com/new/test.html。
server {
# SSL
ssl_certificate /etc/nginx/cert/chained_star_company.com.crt;
ssl_certificate_key /etc/nginx/cert/star_company.com.key;
listen 443;
server_name service.company.com;
location /new/$1 {
return 301 $scheme://service-new.company.com/$1;
}
}
我也尝试了以下相同的结果:
return 301 $scheme://service-new.company.com/$request_uri
【问题讨论】:
标签: redirect nginx url-redirection http-redirect nginx-location