Django + nginx + guniororn - subdomain of joy

I am trying to configure django on nginx + gunicorn on a centos6 server (firewall is off, selinux is off). the project works locally on the server (tested a machine-gun shot at 127.0.0.1:8221), but not across the network. the project must be accessible from the subdomain project.mydomain.com

the project itself is located on the centos6.mydomain.com server, and the dns server main.mydomain.com

my ngnix conf for the project :

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; } } 

nginx conf for centos6 (works)

 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; } } 

gunicorn conf

 import multiprocessing bind = "127.0.0.1:8221" logfile = "/home/USER/djangosites/project/gunicorn.log" workers = multiprocessing.cpu_count() * 2 + 1 

would I rather give a new ip (outside) for a project that is different from centos6.mydomain.com , or can I just use the same ip with a different local port?

how do i configure hosts.db on main.mydomain.com and then?

 centos6 A xxx.xxx.xxx.220 project A xxx.xxx.xxx.221 

or

 centos6 A xxx.xxx.xxx.220 project A xxx.xxx.xxx.220:8221 

or

 centos6 A xxx.xxx.xxx.220 project CNAME centos6 

I am a little inclined to give a new ip, because everything is behind m0n0wall, so a new ip might be easier to manage.

so basically, I assume that my nginx conf for the project is corrupted. what should i do with it?

+4
source share
1 answer

OK. got a job :) hosts.db on main.mydomain.com

 project CNAME centos6 

gunicorn runnig at 127.0.0.1:8221 and edited nginx conf as above.

+2
source

All Articles