Nginx中的uwsgi_pass和proxy_pass之间的区别? [英] Difference between uwsgi_pass and proxy_pass in Nginx?
问题描述
我正在Nginx后面运行uWSGI,并且一直在使用proxy_pass
来使Nginx打uWSGI.切换到uwsgi_pass
有什么好处.如果是这样,那是什么?
I'm running uWSGI behind Nginx and have been using proxy_pass
to get Nginx to hit uWSGI. Is there any benefit to switch to uwsgi_pass
. If so, what is it?
推荐答案
uwsgi_pass
使用uwsgi
协议. proxy_pass
使用普通的HTTP与uWSGI服务器联系. uWSGI文档声称该协议更好,更快,并且可以从uWSGI的所有特殊功能中受益.
uwsgi_pass
uses an uwsgi
protocol. proxy_pass
uses normal HTTP to contact with uWSGI server. uWSGI docs claims that this protocol is better, faster and can benefit from all of uWSGI special features.
有没有真正的好处?是的.您可以向uWSGI发送信息,您正在发送什么类型的数据以及应该调用哪种uWSGI插件来生成响应.使用http(proxy_pass
),您将无法获得.您可以在 uWSGI文档中找到更多信息.
Are there any real benefits? Yes. You can send to uWSGI information what type of data you are sending and what uWSGI plugin should be invoked to generate response. With http (proxy_pass
) you won't get that. More on that you can find in uWSGI docs.
但是即使使用uwsgi协议代替http并没有任何好处,您也应该尽可能使用uwsgi协议,因为uwsgi是uWSGI服务器的主要协议,在这里更合适.
But even if there aren't any documented benefits of using uwsgi protocol instead of http for you, you should use uwsgi protocol if you can, because uwsgi is the main protocol of uWSGI server and it just fits better here.
如果要使用uwsgi协议,必须将uWSGI启动脚本中的http-socket
参数更改为socket
.
If you want to use uwsgi protocol you must change http-socket
parameter in uWSGI start script to socket
.
这篇关于Nginx中的uwsgi_pass和proxy_pass之间的区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!