Nginx, Django, Gunicorn sur l’océan numérique ne peut pas atteindre le domaine. Mauvaise demande (400)

Je peux accéder à mon site lorsque je vais sur mon adresse IP mais je ne peux pas quand je vais sur mon nom de domaine.

Voici mon fichier de configuration nginx (j’ai changé l’adresse IP et les domaines pour la confidentialité):

server { listen 80; server_name my.ip.address example.com www.example.com; location = /facivon.ico { access_log off; log_not_found off; } location /static/ { root /home/tony/vp/vp/config/; } location / { include proxy_params; proxy_pass http://unix:/home/tony/vp/vp/vp.sock; } } 

Et voici mon fichier settings.py de productions:

 from .base import * DEBUG = False ALLOWED_HOSTS = ['127.0.0.1', '0.0.0.0', 'my.ip.address', 'example.com', '.example.com'] ROOT_URLCONF = "urls.production_urls" SECURE_CONTENT_TYPE_NOSNIFF = True SECURE_BROWSER_XSS_FILTER = True SECURE_SSL_DIRECT = True SECURE_SSL_REDIRECT = False SESSION_COOKIE_SECURE = True CSRF_COOKIE_SECURE = True X_FRAME_OPTIONS = 'DENY' SECURE_HSTS_SECONDS = 3600 SECURE_HSTS_INCLUDE_SUBDOMAINS = True SECURE_HSTS_SUBDOMAINS = True SECURE_HSTS_PRELOAD = True # Database # https://docs.djangoproject.com/en/1.11/ref/settings/#databases DATABASES = { 'default': { 'ENGINE': 'django.db.backends.postgresql', 'NAME': 'vp', 'USER': 'vp', 'PASSWORD': os.environ["VP_DB_PASS"], 'HOST': 'localhost', } } MEDIA_ROOT = os.path.join(BASE_DIR, "media") MEDIA_URL ='media/' STATIC_ROOT = os.path.join(BASE_DIR, 'static/') 

Et oui, mon domaine est connecté à l’océan numérique.

Quelle pourrait être la cause de la mauvaise demande?

Merci d’avance!

MODIFIER:

Pour une raison quelconque, j’ai plus d’une erreur.log pour nginx. Cela a probablement quelque chose à voir avec mes nombreuses tentatives pour résoudre ce problème. Vous trouverez ci-dessous le fichier error.log pertinent:

 2017/04/23 17:44:56 [alert] 17723#17723: *7 open socket #12 left in connection 4 2017/04/23 17:44:56 [alert] 17723#17723: *10 open socket #13 left in connection 6 2017/04/23 17:44:56 [alert] 17723#17723: *11 open socket #14 left in connection 7 2017/04/23 17:44:56 [alert] 17723#17723: *13 open socket #16 left in connection 9 2017/04/23 17:44:56 [alert] 17723#17723: *14 open socket #17 left in connection 10 2017/04/23 17:44:56 [alert] 17723#17723: *15 open socket #18 left in connection 11 2017/04/23 17:44:56 [alert] 17723#17723: aborting 2017/04/23 23:26:15 [emerg] 20136#20136: unknown directive "cd" in /etc/nginx/sites-enabled/vp:1 2017/04/23 23:27:12 [emerg] 20147#20147: unknown directive "cd" in /etc/nginx/sites-enabled/vp:1 2017/04/23 23:37:43 [alert] 20399#20399: *12 open socket #14 left in connection 7 2017/04/23 23:37:43 [alert] 20399#20399: *7 open socket #18 left in connection 9 2017/04/23 23:37:43 [alert] 20399#20399: aborting 

La ligne: directive inconnue “cd” dans / etc / nginx / sites-enabled / vp: 1 est corrigée.

En vérifiant l’état de gunicorn, j’obtiens les informations suivantes:

 sudo systemctl status gunicorn ● gunicorn.service - gunicorn daemon Loaded: loaded (/etc/systemd/system/gunicorn.service; enabled; vendor preset: enabled) Active: active (running) since Sun 2017-04-23 14:52:07 UTC; 19h ago Main PID: 16044 (gunicorn) Tasks: 4 Memory: 86.6M CPU: 42.667s CGroup: /system.slice/gunicorn.service ├─16044 /home/tony/vp/vpenv/bin/python3 /home/tony/vp/vpenv/bin/gunicorn --workers 3 --bind unix:/home/tony/vp/vp/vp.sock vp.wsgi:application ├─16049 /home/tony/vp/vpenv/bin/python3 /home/tony/vp/vpenv/bin/gunicorn --workers 3 --bind unix:/home/tony/vp/vp/vp.sock vp.wsgi:application ├─16050 /home/tony/vp/vpenv/bin/python3 /home/tony/vp/vpenv/bin/gunicorn --workers 3 --bind unix:/home/tony/vp/vp/vp.sock vp.wsgi:application └─16051 /home/tony/vp/vpenv/bin/python3 /home/tony/vp/vpenv/bin/gunicorn --workers 3 --bind unix:/home/tony/vp/vp/vp.sock vp.wsgi:application Apr 23 14:52:07 vp-first gunicorn[16044]: [2017-04-23 14:52:07 +0000] [16044] [INFO] Starting gunicorn 19.7.1 Apr 23 14:52:07 vp-first gunicorn[16044]: [2017-04-23 14:52:07 +0000] [16044] [INFO] Listening at: unix:/home/tony/vp/vp/vp.sock (16044) Apr 23 14:52:07 vp-first gunicorn[16044]: [2017-04-23 14:52:07 +0000] [16044] [INFO] Using worker: sync Apr 23 14:52:07 vp-first gunicorn[16044]: [2017-04-23 14:52:07 +0000] [16049] [INFO] Booting worker with pid: 16049 Apr 23 14:52:07 vp-first gunicorn[16044]: [2017-04-23 14:52:07 +0000] [16050] [INFO] Booting worker with pid: 16050 Apr 23 14:52:07 vp-first gunicorn[16044]: [2017-04-23 14:52:07 +0000] [16051] [INFO] Booting worker with pid: 16051 Apr 23 15:27:51 vp-first systemd[1]: Started gunicorn daemon. Apr 23 17:12:36 vp-first systemd[1]: Started gunicorn daemon. Apr 23 17:31:37 vp-first systemd[1]: Started gunicorn daemon. Apr 23 23:35:18 vp-first systemd[1]: Started gunicorn daemon.