0
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;

        }
    }

配置有点工作,但它只通过

localhost:9292/json to localhost/json.

但我想要的是

localhost:9292/json to 'localhost'

`localhost:9292/json/post 到 'localhost/post'

我想我需要做的是设置root或进行一些重写,有人有什么想法吗?

4

1 回答 1

1

在之前添加重写规则proxy_pass

location /json {
    rewrite ^/json(.*) $1;
    proxy_pass http://localhost:9292;
}
于 2013-08-06T07:09:42.397 回答