location /detail/json {
if ( $uri = "/detail/json" ) {
rewrite "/detail/json" /index.html break;
}
alias /data/web/static_test/detail/json/$host/;
proxy_pass http://192.168.1.2;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
index index.html;
default_type application/json;
proxy_redirect off;
proxy_intercept_errors on;
error_page 403 404 = @index;html
location /lvpai/ware {
proxy_pass http://192.1.1.2:9997;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header REMOTE-HOST $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;nginx
location @index {
try_files $uri /lvpai/ware/$uri;
}web
解讀:在1.1上面配置nginx 把根路徑配置在1.2上面json
若是訪問的地址是http://域名/detail/json/xx 實際上獲取的資源是1.2相應的路徑下的資源app
若是1.2下不存在要訪問的資源,而後去找try_fileshtm