Mywebsite.co.uk显示502错误。运行sudo tail -F /var/log/nginx/error.log
输出:
2020/10/22 09:42:13 [warn] 200096#200096: conflicting server name "mywebsite.co.uk" on 0.0.0.0:80, ignored
2020/10/22 09:42:13 [warn] 200107#200107: conflicting server name "mywebsite.co.uk" on 0.0.0.0:80, ignored
2020/10/22 09:42:29 [error] 200110#200110: *1 open() "/home/user/mywebsite-app/static/admin/css/fonts.css" failed (2: No such file or directory), client: 37.70.203.239, server: mywebsite.co.uk, request: "GET /static/admin/css/fonts.css HTTP/1.1", host: "mywebsite.co.uk", referrer: "http://mywebsite.co.uk/"
2020/10/22 09:42:50 [crit] 200110#200110: *4 connect() to unix:/home/django/gunicorn.socket failed (2: No such file or directory) while connecting to upstream, client: 37.70.203.239, server: _, request: "GET / HTTP/1.1", upstream: "http://unix:/home/django/gunicorn.socket:/", host: "xxx.xx.xxx.xxx"
2020/10/22 09:42:51 [crit] 200110#200110: *4 connect() to unix:/home/django/gunicorn.socket failed (2: No such file or directory) while connecting to upstream, client: 37.70.203.239, server: _, request: "GET / HTTP/1.1", upstream: "http://unix:/home/django/gunicorn.socket:/", host: "xxx.xx.xxx.xxx"
2020/10/22 09:43:00 [error] 200110#200110: *1 open() "/home/user/mywebsite-app/static/admin/css/fonts.css" failed (2: No such file or directory), client: 37.70.203.239, server: mywebsite.co.uk, request: "GET /static/admin/css/fonts.css HTTP/1.1", host: "mywebsite.co.uk", referrer: "http://mywebsite.co.uk/"
2020/10/22 09:43:24 [error] 200110#200110: *1 open() "/home/user/mywebsite-app/static/admin/css/fonts.css" failed (2: No such file or directory), client: 37.70.203.239, server: mywebsite.co.uk, request: "GET /static/admin/css/fonts.css HTTP/1.1", host: "mywebsite.co.uk", referrer: "http://mywebsite.co.uk/"
2020/10/22 09:57:01 [crit] 200110#200110: *10 connect() to unix:/home/django/gunicorn.socket failed (2: No such file or directory) while connecting to upstream, client: 103.42.252.150, server: _, request: "GET / HTTP/1.0", upstream: "http://unix:/home/django/gunicorn.socket:/", host: "xxx.xx.xxx.xxx:80"
2020/10/22 10:07:00 [error] 200110#200110: *12 open() "/home/user/mywebsite-app/static/admin/css/fonts.css" failed (2: No such file or directory), client: 37.70.203.239, server: mywebsite.co.uk, request: "GET /static/admin/css/fonts.css HTTP/1.1", host: "mywebsite.co.uk", referrer: "http://mywebsite.co.uk/"
2020/10/22 10:07:28 [crit] 200110#200110: *15 connect() to unix:/home/django/gunicorn.socket failed (2: No such file or directory) while connecting to upstream, client: 37.70.203.239, server: _, request: "GET / HTTP/1.1", upstream: "http://unix:/home/django/gunicorn.socket:/", host: "xxx.xx.xxx.xxx"
我想这可能与gunicorn.socket
在/etc/systemd/system/gunicorn.socket
而不是在unix:/home/django/gunicorn.socket
有关?我需要在哪里更改?还有什么问题?
我的枪库:
[Unit]
Description=gunicorn daemon
Requires=gunicorn.socket
After=network.target
[Service]
User=user
Group=user
EnvironmentFile=/home/user/mywebsite-app/env
WorkingDirectory=/home/user/mywebsite-app
ExecStart=/home/user/env/bin/gunicorn
--access-logfile -
--workers 3
--bind unix:/run/gunicorn.sock
mywebsite-app.wsgi:application
[Install]
WantedBy=multi-user.target
在上游或代理中使用unix:/run/gunicorn.sock,而不是您的unix:/home/django/gunicorn.socket