2017-06-18 1 views
0

Je regardais partout sur Internet pour trouver des solutions, mais aucune n'a aidé. Je veux déployer un projet django sur mon serveur pointé sur vps.florisdeboer.com. J'ai lu quelques tutoriels et fait exactement ce qu'ils m'ont dit, mais l'erreur 502 continue à apparaître.-nginx, uwsgi, 502 Mauvaise passerelle sur le domaine

J'ai tous les fichiers importants, si vous manquez quelque chose, s'il vous plaît commenter pendant que je peux le poster comme un edit.

OK, allons:

Le projectname est webshop. Rien de spécial, juste une boutique en ligne construite en django. J'utilise db.sqlite3 comme base de données.

/etc/uwsgi/sites

[uwsgi]  
project = webshop 
uid = floris 
base = /home/%(uid) 

chdir = %(base)/%(project) 
home = %(base)/BIT/ 
module = %(project).wsgi:application 

master = true 
processes = 5 

socket = /run/uwsgi/%(project).sock 
chown-socket = %(uid):www-data 
chmod-socket = 660 
vacuum = true 

plugins=python27 

/etc/nginx/sites activés

server { 
    listen 80; 
    server_name florisdeboer.com vps.florisdeboer.com; 

    location = /favicon.ico { access_log off; log_not_found off; } 
    location /static/ { 
     root /home/floris/webshop; 
    } 

    location/{ 
     include   uwsgi_params; 
     uwsgi_pass  unix:/run/uwsgi/website.sock; 
    } 
} 

Et le sudo systemctl status uwsgi

● uwsgi.service - uWSGI Emperor service 
    Loaded: loaded (/etc/systemd/system/uwsgi.service; enabled; vendor preset: enabled) 
    Active: active (running) since Sat 2017-06-17 22:13:00 CEST; 17h ago 
Main PID: 24782 (uwsgi) 
    Status: "The Emperor is governing 1 vassals" 
    CGroup: /system.slice/uwsgi.service 
      ├─24782 /usr/local/bin/uwsgi --emperor /etc/uwsgi/sites 
      ├─24785 /usr/local/bin/uwsgi --ini webshop.ini 
      ├─24788 /usr/local/bin/uwsgi --ini webshop.ini 
      ├─24789 /usr/local/bin/uwsgi --ini webshop.ini 
      ├─24790 /usr/local/bin/uwsgi --ini webshop.ini 
      ├─24791 /usr/local/bin/uwsgi --ini webshop.ini 
      └─24792 /usr/local/bin/uwsgi --ini webshop.ini 

Jun 18 15:54:21 srvrfloris systemd[1]: Started uWSGI Emperor service. 
Jun 18 15:57:20 srvrfloris systemd[1]: Started uWSGI Emperor service. 
Jun 18 15:58:18 srvrfloris systemd[1]: Started uWSGI Emperor service. 
Warning: Journal has been rotated since unit was started. Log output is incomplete or una was started. Log output is incomplete or unavailable. 

est ici la même commande que ci-dessus mais pour nginx

● nginx.service - A high performance web server and a reverse proxy server 
    Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled) 
    Active: active (running) since Sun 2017-06-18 15:54:13 CEST; 14min ago 
Main PID: 882 (nginx) 
    CGroup: /system.slice/nginx.service 
      ├─882 nginx: master process /usr/sbin/nginx -g daemon on; master_process on 
      └─883 nginx: worker process       

Jun 18 15:54:13 srvrfloris systemd[1]: Starting A high performance web server and a revering A high performance web server and a reverse proxy server... 

Jun 18 15:54:13 srvrfloris systemd[1]: nginx.service: Failed to read PID from file /run/n.service: Failed to read PID from file /run/nginx.pid: Invalid argument 

Jun 18 15:54:13 srvrfloris systemd[1]: Started A high performance web server and a reversed A high performance web server and a reverse proxy server. 

~ 

L'erreur log de root $ uwsgi --ini /etc/uwsgi/sites/webshop.ini

[uWSGI] getting INI configuration from /etc/uwsgi/sites 
*** WARNING: Can't find section "uwsgi" in INI configuration file /etc/uwsgi/sites *** 
*** Starting uWSGI 2.0.15 (64bit) on [Sun Jun 18 23:08:20 2017] *** 
compiled with version: 5.4.0 20160609 on 17 June 2017 21:30:14 
os: Linux-4.4.0-66-generiC#87-Ubuntu SMP Fri Mar 3 15:29:05 UTC 2017 
nodename: srvrfloris 
machine: x86_64 
clock source: unix 
detected number of CPU cores: 1 
current working directory: /home/floris 
detected binary path: /usr/local/bin/uwsgi 
!!! no internal routing support, rebuild with pcre support !!! 
uWSGI running as root, you can use --uid/--gid/--chroot options 
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) *** 
*** WARNING: you are running uWSGI without its master process manager *** 
your processes number limit is 3826 
your memory page size is 4096 bytes 
detected max file descriptor number: 1024 
lock engine: pthread robust mutexes 
thunder lock: disabled (you can enable it with --thunder-lock) 
The -s/--socket option is missing and stdin is not a socket. 

J'espère que quelqu'un peut me aider!

Cheers,

Floris

+0

et sur les répertoires "/ run/uwsgi"? – Tamar

+0

'drwxr-xr-x 2 floris www-data 40 juin 18 16:16/run/uwsgi' pour/run/uwsgi –

+0

' drwxrwxr-x 7 floris floris 4096 17 juin 21:27/home/floris/webshop' pour/home/floris/webshop –

Répondre

1

Si la question est réelle. dans cette ligne changer de site Web à la boutique en ligne unix: /run/uwsgi/website.sock; et redémarrez votre droplet ou votre serveur. Quelles sont les permissions sur% (base) /% (project)?