server {
listen 80;
server_name localhost;
location / {
index index.html;
root /Users/Lin/Codes/JS/Emberjs/yeoman-ember/dist;
}
location ~* ^/json {
root
proxy_pass http://localhost:9292;
}
}
configure kinda有效,但只传递
localhost:9292/json to localhost/json.
但我想要的是
localhost:9292/json to 'localhost'
`localhost:9292 / json / post to' localhost / post'
我认为我需要做的是设置root或做一些重写,任何人都有一些想法?
答案 0 :(得分:1)
在proxy_pass
location /json {
rewrite ^/json(.*) $1;
proxy_pass http://localhost:9292;
}