How to configure nginx for django with gunicorn?
<p>I have successfully run gunicorn and confirmed that my web runs on localhost:8000. But I can't get nginx right. My config file goes like this:</p>

<pre><code>    server {
    listen 80;
    server_name 104.224.149.42;
    location / {
        proxy_pass http://127.0.0.1:8000;
        }
    }
</code></pre>

<p>104.224.149.42 is the ip for outside world.</p>

<p>Do this</p>

<ul>
<li>Remove <code>default</code> from <code>/etc/nginx/sites-enabled/default</code></li>
</ul>

<p>Create <code>/etc/nginx/sites-available/my.conf</code> with following</p>

<pre><code>server {
listen 80;
server_name 104.224.149.42;
location / {
    proxy_pass http://127.0.0.1:8000;
    }
}
</code></pre>

<p>Then <code>sudo ln -s /etc/nginx/sites-available/my.conf /etc/nginx/sites-enabled/my.conf</code></p>

<ul>
<li>restart <code>nginx</code></li>
</ul>

<p>You have to configure <code>static</code> files and <code>media</code> files serving.</p>

python django nginx