Question
Nginx, Gunicorn v18, and 2 Django v1.7rc1 sites - all traffic is routed to one site.
I have the above config on a Debian droplet. I have a staging site (staging.flashcard101.com) and a live site (flashcard101.com). DNS for both are pointing to the droplet IP address. When I browse to the respective sites, some devices and browsers work fine, but some only show the live content at both domain names. It seems nginx does not direct the traffic correctly each time. Any idea what may be going on, or where I should look to diagnose? Thanks.
Here are my nginx configs:
live:
server {
listen 80;
server_name www.flashcard101.com;
location /static {
alias /home/fc/sites/www.flashcard101.com/static;
}
location /media {
alias /home/fc/sites/www.flashcard101.com/media;
}
location / {
proxy_set_header Host $host;
proxy_pass http://unix:/tmp/www.flashcard101.com.socket;
}
}
Staging:
server {
listen 80;
server_name www.staging.flashcard101.com;
location /static {
alias /home/fc/sites/www.staging.flashcard101.com/static;
}
location /media {
alias /home/fc/sites/www.staging.flashcard101.com/media;
}
location / {
proxy_set_header Host $host;
proxy_pass http://unix:/tmp/www.staging.flashcard101.com.socket;
}
}
Gunicorn confs:
Live:
description "Gunicorn server for www.flashcard101.com"
start on net-device-up
stop on shutdown
respawn
setuid fc
chdir /home/fc/sites/www.flashcard101.com/source
exec ../venv/bin/gunicorn \
--bind unix:/tmp/www.flashcard101.com.socket \
--access-logfile ../access.log \
--error-logfile ../error.log \
flf.wsgi:application
Staging:
description "Gunicorn server for www.staging.flashcard101.com"
start on net-device-up
stop on shutdown
respawn
setuid fc
chdir /home/fc/sites/www.staging.flashcard101.com/source
exec ../venv/bin/gunicorn \
--bind unix:/tmp/www.staging.flashcard101.com.socket \
--access-logfile ../access.log \
--error-logfile ../error.log \
flf.wsgi:application
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
×