Nginx反向代理配置 [英] Nginx reverse proxy configuration
本文介绍了Nginx反向代理配置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要nginx来反向代理以下形式的GET和POST请求:
I need nginx to reverse- proxy GET and POST requests of the form:
/myapp/path/to/resource
收件人:
http://127.0.0.1:9090/path/to/resource
我正在尝试以下操作:
location /myapp/(.*) {
rewrite $1;
proxy_pass http://127.0.0.1:9090;
}
但是nginx返回HTTP 405错误[不允许].
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/;
}
这篇关于Nginx反向代理配置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文