Deploying CherryPy apps: Standalone, WSGI Server or NGinx?

Eyeball Trees asked:

I intend to use a single VPS to deploy multiple low-traffic CherryPy apps as subdirectories; eg:,, etc.

After researching on WSGI deployment, it looks like the preferred method for deploying apps is to use a WSGI server (Gunicorn, uWSGI, etc) and NGinx in a reverse-proxy setup. It seems like overkill to use two webservers in tandem — especially since my CherryPy app is itself a webserver — but I don’t want to dismiss the idea as it appears everywhere. I’m certainly not an expert so I’d like to discuss it.

I see three options:

  • Deploy CherryPy by itself.
  • Deploy beneath Gunicorn or another WSGI server.
  • Deploy beneath a WSGI server and reverse-proxy to NGinx, which seems to be everyone’s solution.

My questions:

  • What’s the main reason I see this pattern everywhere? Is NGinx just that good?
  • For low-traffic apps, is the native CherryPy server good enough, or should I not even try?

Any and all advice is appreciated, thank you.

My answer:

The reason everyone puts nginx (or another server such as Apache) in front of their app servers is that everyone has static content such as images, CSS and JavaScript, and strange requirements which are unique to their application.

Your app server (CherryPy, gunicorn, whatever) is optimized to run your app and serve its output. While the app server can also serve static content, they are almost never well optimized for this task, since it’s secondary to the main purpose of the app server. (Some app servers will also help by minifying and compressing your CSS and JS, so that the web server in front can serve these resources even faster.)

In addition, the actual web server can do much more than high performance content serving. Things like caching, header manipulation, URL rewriting, geolocation, and many other features that would just bloat the app server to no good purpose.

Typically you would run the app server alone only when developing the application, when you are the only user, and performance is not an issue. Even if your site is low traffic, you would like it to be faster, right? Low traffic sites which are slow don’t generally grow into high traffic sites…

View the full question and answer on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.