Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Replacing nginx with uwsgi

It seems that uwsgi is capable of doing almost anything I am using nginx for: serving static content, execute PHP scripts, host python web apps, ... So (in order to simplify my environment) can I replace nginx + uwsgi with uwsgi without loss of performance/functionality?

like image 455
Mahdi Avatar asked Sep 12 '14 19:09

Mahdi


1 Answers

As they say in the documentation:

Can I use uWSGI’s HTTP capabilities in production?

If you need a load balancer/proxy it can be a very good idea. It will automatically find new uWSGI instances and can load balance in various ways. If you want to use it as a real webserver you should take into account that serving static files in uWSGI instances is possible, but not as good as using a dedicated full-featured web server. If you host static assets in the cloud or on a CDN, using uWSGI’s HTTP capabilities you can definitely avoid configuring a full webserver.

So yes, uWSGI is slower than a traditional web server.

Besides performance, in a really basic application you're right, uWSGI can do everything the webserver offers. However, should your application grow/change over time you may find that there are many things the traditional webserver offers which uWSGI does not.

I would recommend setting up deploy scripts in your language of choice (such as Fabric for Python). I would say my webserver is one of the simplest components to deploy & setup in our applications stack, and the least "needy" - it is rarely on my radar unless I'm configuring a new server.

like image 62
Jason Avatar answered Oct 10 '22 06:10

Jason