我的配置:
server {
listen 80;
listen 443 spdy;
server_name subdomain.domain.com;
add_header Alternate-Protocol 443:npn-spdy/3.1;
include custom.d/ssl-redirect.conf;
ssl_certificate /etc/ssl/domain.com/domain_com-nginx.crt;
ssl_certificate_key /etc/ssl/domain.com/domain_com.key;
access_log /var/log/nginx/domain_com.access.log geo;
error_log /var/log/nginx/domain_com.error.log error;
set $fpm_pool domain.com;
root /home/domain.com/htdocs/domain_com/public;
index index.html index.php;
location / {
proxy_pass https://domain.com/mypath;
}
include custom.d/restrictions.conf;
include custom.d/fpmstatus.conf;
}
我有https://domain.com/mypath网址。 我想在调用subdomain.domain.com时看这个 当我调用subdomain.domain.com/sompage时。可能是扔https://domain.com/mypath/sompage
答案 0 :(得分:0)
您只需要添加一个返回,最好的是这里的301状态代码:
return 301 https://domain.com/mypath$request_uri;
在您的代码中可能看起来像这样:
server {
listen 80;
listen 443 spdy;
server_name subdomain.domain.com;
add_header Alternate-Protocol 443:npn-spdy/3.1;
include custom.d/ssl-redirect.conf;
ssl_certificate /etc/ssl/domain.com/domain_com-nginx.crt;
ssl_certificate_key /etc/ssl/domain.com/domain_com.key;
access_log /var/log/nginx/domain_com.access.log geo;
error_log /var/log/nginx/domain_com.error.log error;
set $fpm_pool domain.com;
root /home/domain.com/htdocs/domain_com/public;
index index.html index.php;
return 301 https://domain.com/mypath$request_uri;
include custom.d/restrictions.conf;
include custom.d/fpmstatus.conf;
}