title: Deploying Django with gunicorn and nginx
body: <p>This is a broad question but I'd like to get a canonical answer. I have been trying to deploy a site using <em>gunicorn</em> and <em>nginx</em> in <em>Django</em>. After reading tons of tutorials I have been successful but I can't be sure that the steps I followed are good enough to run a site without problems or maybe there are better ways to do it. That uncertainty is annoying.</p>
  
  <p>That's why I'm looking for a very detailed and well explained answer for newbies. I don't want to explain too much what I know and what I don't know since this could skew the answers a bit and other people could benefit to a lesser degree from your answers. However, some things I'd like to see mentioned are:</p>
  
  <ul>
  <li><p>What "setup" have you seen work best? I used <em>virtualenv</em> and moved my <em>Django</em> project inside this environment, however I have seen another setups where there is a folder for virtual environments and other for projects.</p></li>
  <li><p>How can I setup things in a way that allows several sites to be hosted in a single server?</p></li>
  <li><p>Why some people suggest using <code>gunicorn_django -b 0.0.0.0:8000</code> and others suggest <code>gunicorn_django -b 127.0.0.1:8000</code>? I tested the latter in an Amazon EC2 instance but it didn't work while the former worked without problem.</p></li>
  <li><p>What is the logic behind the config file of nginx? There are so many tutorials using drastically different configuration files that I'm confused on which one is better. For example, some people use <code>alias /path/to/static/folder</code> and others <code>root /path/to/static/folder</code>. Maybe you can share your preferred configuration file.</p></li>
  <li><p>Why do we create a symlink between <code>site-available</code> and <code>sites-enabled</code> in <code>/etc/nginx</code>?</p></li>
  <li><p>Some best practices are as always welcomed :-)</p></li>
  </ul>
  
  <p>Thanks</p>