My main question here is: Did I set it up right, or what would be the more preferable way of going about it regarding the directory structure, configs, whatever else I may just not know about for setting up a web server! Is there something I need to do to ensure it auto-restarts if the server crashes or something? I guess I could have asked this in a support ticket, but figured
I just recently got a server with WebFaction and started trying to set it up with using nginx+gunicorn+flask as my first project. I started by installing python 2.7.2 into lib/python2.7.2 and then installed distribute/pip/virtualenv/virtualenvwrapper for that python install and created a virualenv from it. I downloaded and extracted nginx-1.0.11 into
I read through a lot of the nginx docs, and understand the majority of the various settings/directives. I am not completely sure how the magic works with the
This is my current
I then created the following
and then a simple flask app to test it all(
Given those files I start nginx by calling
Anyways my goal for this post is to hopefully get some tips from those with more experience on the best way to setup the nginx/gunicorn config, as well as hopefully give people trying to do this some guidance to at least get to the level of having a working site.
asked 27 Jan '12, 12:22
A few things to cover,
Your python steps are OK, you likely did not need to build python from source, but it does not hurt.
For the guicorn app and frontend setting you need a second 'custom app' and you should be using its port. You can technically assign any port that is open on the server, however we will not promise that the port will not get assigned in the future, and if your are using it and not assigned to it we may stop the app and send you a warning.
Although it gives you an extra layer of configuration, which sometimes you want, you do not need to build your own nginx stack to deploy this. The front-end nginx server is already a proxy server that can have a port assigned to it.
I have a community post that deploys django using the front-end nginx server and guinicorn. The same general steps apply to other gunicorn apps.
answered 27 Jan '12, 17:16