Nginx reverse proxy configuration

送分小仙女□ 提交于 2021-02-07 20:39:18

问题


I need nginx to reverse- proxy GET and POST requests of the form:

/myapp/path/to/resource 

to:

http://127.0.0.1:9090/path/to/resource

I'm trying the following:

location /myapp/(.*) {
  rewrite $1;
  proxy_pass http://127.0.0.1:9090;
}

but nginx is returning a HTTP 405 error [not allowed].

Any ideas on how to fix this ? Thanks.


回答1:


You don't actually need to do a rewrite. You can achieve the same end with the following:

location /myapp/ {
  proxy_pass http://127.0.0.1:9090/;
}


来源:https://stackoverflow.com/questions/3505772/nginx-reverse-proxy-configuration

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!