[英]How to rewrite localhost:9292/json to localhost:80/ using Nginx reverse proxy?
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;
}
}
The configure kinda works, but it only pass 配置还可以,但是只能通过
localhost:9292/json to localhost/json.
But What I want is 但是我想要的是
localhost:9292/json to 'localhost'
`localhost:9292/json/post to 'localhost/post' `localhost:9292 / json / post到'localhost / post'
I think what I need to do is set root or do some rewrite, Anyone has some idea? 我认为我需要做的是设置root或进行一些重写,有人有想法吗?
add a rewrite rule before the proxy_pass
在
proxy_pass
之前添加重写规则
location /json {
rewrite ^/json(.*) $1;
proxy_pass http://localhost:9292;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.