Note that there are some explanatory texts on larger screens.

plurals
  1. POdjango+nginx+gunicorn - subdomain joy
    text
    copied!<p>i'm trying to setup <strong>django</strong> on <strong>nginx + gunicorn</strong> on a centos6 server (firewall off, selinux disabled). the project works locally on the server (tested running gunicorn on 127.0.0.1:8221), but not on the whole network. the project should be accessible from a subdomain <strong>project.mydomain.com</strong></p> <p>the project itself is located on a server <strong>centos6.mydomain.com</strong> and the dns server is <strong>main.mydomain.com</strong></p> <p>my <strong>ngnix conf</strong> for the <strong>project</strong>:</p> <pre><code>upstream project { server 127.0.0.1:8221 fail_timeout=0; } server { listen 80; server_name project.mydomain.com; access_log /var/log/nginx/project.mydomain.com.log; error_log /var/log/nginx/project.mydomain.com.log; root /home/USER/djangosites/project; location / { proxy_set_header Host $host; if (!-f $request_filename){ proxy_pass http://project; break; } } location /media { alias /home/USER/djangosites/project/media; } location /static { alias /home/USER/djangosites/project/static; } } </code></pre> <p><strong>nginx conf</strong> for the <strong>centos6</strong> (working)</p> <pre><code>server { listen 80 default_server; server_name centos6.mydomain.com; access_log /var/log/nginx/centos6.mydomain.com.access.log main; error_log /var/log/nginx/centos6.mydomain.com.error.log; location / { root /var/www/centos6.mydomain.com; index index.html; } } </code></pre> <p><strong>gunicorn conf</strong></p> <pre><code>import multiprocessing bind = "127.0.0.1:8221" logfile = "/home/USER/djangosites/project/gunicorn.log" workers = multiprocessing.cpu_count() * 2 + 1 </code></pre> <p>would i be better off giving a new ip (to the outside) to the project that is different from <strong>centos6.mydomain.com</strong> or i can just use the same ip with different local port?</p> <p>how should i configure <strong>hosts.db</strong> on <strong>main.mydomain.com</strong> then?</p> <pre><code>centos6 A xxx.xxx.xxx.220 project A xxx.xxx.xxx.221 </code></pre> <p>or</p> <pre><code>centos6 A xxx.xxx.xxx.220 project A xxx.xxx.xxx.220:8221 </code></pre> <p>or</p> <pre><code>centos6 A xxx.xxx.xxx.220 project CNAME centos6 </code></pre> <p>i'm kind of more inclined to give a new ip because everything is behind a m0n0wall, so a new ip could perhaps be easier to manage.</p> <p>so basically, i'm guessing that my nginx conf for the project is flawed. what should i do with it?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload