开发者

Nginx reverse proxy configuration

开发者 https://www.devze.com 2023-01-12 12:26 出处:网络
I need nginx to reverse- pro开发者_StackOverflow中文版xy GET and POST requests of the form: /myapp/path/to/resource

I need nginx to reverse- pro开发者_StackOverflow中文版xy 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.


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

精彩评论

暂无评论...
验证码 换一张
取 消