Difference between uwsgi_pass and proxy_pass in Nginx?

Eli picture Eli · Jan 2, 2016 · Viewed 12.2k times · Source

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?

Answer

GwynBleidD picture GwynBleidD · Jan 2, 2016

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.

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.

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.

If you want to use uwsgi protocol you must change http-socket parameter in uWSGI start script to socket.