-nginx,uwsgi,502域上的网关错误

时间:2017-06-18 14:11:41

标签: django nginx uwsgi

我在互联网上寻找解决方案,但没有人帮忙。 我想在我的服务器上部署一个django项目,指向vps.florisdeboer.com。我已经阅读了一些教程并完全按照他们告诉我的内容,但502错误不断出现。

我收到了所有重要文件,如果你错过了什么,请发表评论,我可以将其作为编辑发布。

好的,让我们走吧:

项目名称是网上商店。没什么特别的,只是在django建一个网店。我使用db.sqlite3作为我的数据库。

的/ etc / uwsgi /位点

[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的/网站启用

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

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.

以上是与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.

~

来自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.

我希望有人可以帮助我!

干杯,

弗洛

1 个答案:

答案 0 :(得分:1)

如果问题是实际的。 在该行中将网站更改为网上商店unix:/run/uwsgi/website.sock; 并重启你的Droplet或服务器。

相关问题