listen 80;
server_name test.com
#默认其他
location / {
try_files $uri $uri/ /index.php?$query_string;
}
#转发(将test.com/spider/ 转发到 http://dev.com/ )
location /spider/ {
#rewrite 格式为: rewrite 规则 定向路径 重写类型;
rewrite ^/spider/(.*)$ /$1 break;
proxy_pass http://dev.com/;
#以下两个header解决跨域问题
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
网友评论