thanks for the answers guys, to clarify what I have setup:
Django settings.py allowed hosts:
ALLOWED_HOSTS = [‘128.199.120.162’, 'codego.co’, ’www.codego.co’]
Nginx server setup in /etc/nginx/sites-available:
“”“
server {
listen 80;
server_name 128.199.120.162 codego.co www.codego.co;
access_log on;
location = /favicon.ico { access_log off; log_not_found off; }
location /static/ {
root /home/david/codegoblog;
}
location /media/ {
root /home/david/codegoblog;
}
location / {
include uwsgi_params;
uwsgi_pass unix:/run/uwsgi/codegoblog.sock;
}
}
”“”
this is a sample output of Nginx error log:
1.157.96.109, server: 128.199.120.162, request: “GET http://www.so.com/?rands=_160219332017520361821316 HTTP/1.0”, upstream: “uwsgi://unix:/run/uwsgi/firstsite.sock:”, host: “www.so.com”
2017/03/08 03:49:16 [crit] 28812#28812: *978 connect() to unix:/run/uwsgi/firstsite.sock failed (2: No such file or directory) while connecting to upstream, client: 61.157.96.109, server: 128.199.120.162, request: “GET http://m.baidu.com/?rands=_1507898306026201794660928 HTTP/1.0”, upstream: “uwsgi://unix:/run/uwsgi/firstsite.sock:”, host: “m.baidu.com”
2017/03/08 03:49:17 [crit] 28812#28812: *980 connect() to unix:/run/uwsgi/firstsite.sock failed (2: No such file or directory) while connecting to upstream, client: 61.157.96.109, server: 128.199.120.162, request: “GET http://www.sogou.com/?rands=_414056450811964332892176 HTTP/1.0”, upstream: “uwsgi://unix:/run/uwsgi/firstsite.sock:”, host: “www.sogou.com”
2017/03/08 04:16:11 [crit] 28812#28812: *984 connect() to unix:/run/uwsgi/firstsite.sock failed (2: No such file or directory) while connecting to upstream, client: 163.172.168.251, server: 128.199.120.162, request: “GET http://www.bing.com HTTP/1.1”, upstream: “uwsgi://unix:/run/uwsgi/firstsite.sock:”, host: “www.bing.com”
as you can see I have uwsgi as well and this is the error log from that:
Thu Feb 16 07:32:03 2017 - received message 0 from emperor
SIGINT/SIGQUIT received…killing workers…
worker 1 buried after 1 seconds
worker 2 buried after 1 seconds
worker 3 buried after 1 seconds
worker 4 buried after 1 seconds
worker 5 buried after 1 seconds
goodbye to uWSGI.
chdir(): No such file or directory [core/uwsgi.c line 1610]
VACUUM: unix socket /var/uwsgi/codego.sock removed.
so there appear to be errors in both the nginx and uwsgi logs but then why is the site running just fine at http://128.199.120.162/ ?