django - 502 Bad Gateway nginx 服务器
问题描述
我正在按照 satssehgal 教程在云服务器上托管网站。
不幸的是,我得到了一个 502 Bad Gateway。
这是我的 nginx/error.log
2021/06/25 12:18:58 [crit] 2494#2494: *1 connect() to unix:/home/seast/blog/blog.sock failed (13: Permission denied) while connecting to upstream, client: 85.68.32.122, server: 139.162.255.54, request: "GET / HTTP/1.1", upstream: "http://unix:/home/seast/blog/blog.sock:/", host: "139.162.255.54"
2021/06/25 12:19:07 [crit] 2494#2494: *3 connect() to unix:/home/seast/blog/blog.sock failed (13: Permission denied) while connecting to upstream, client: 85.68.32.122, server: 139.162.255.54, request: "GET / HTTP/1.1", upstream: "http://unix:/home/seast/blog/blog.sock:/", host: "139.162.255.54"
2021/06/25 12:19:08 [crit] 2519#2519: *1 connect() to unix:/home/seast/blog/blog.sock failed (13: Permission denied) while connecting to upstream, client: 85.68.32.122, server: 139.162.255.54, request: "GET / HTTP/1.1", upstream: "http://unix:/home/seast/blog/blog.sock:/", host: "139.162.255.54"
2021/06/25 12:19:10 [crit] 2519#2519: *1 connect() to unix:/home/seast/blog/blog.sock failed (13: Permission denied) while connecting to upstream, client: 85.68.32.122, server: 139.162.255.54, request: "GET / HTTP/1.1", upstream: "http://unix:/home/seast/blog/blog.sock:/", host: "139.162.255.54"
2021/06/25 12:20:58 [crit] 2519#2519: *5 connect() to unix:/home/seast/blog/blog.sock failed (13: Permission denied) while connecting to upstream, client: 85.68.32.122, server: 139.162.255.54, request: "GET /admin HTTP/1.1", upstream: "http://unix:/home/seast/blog/blog.sock:/admin", host: "139.162.255.54"
2021/06/25 12:21:03 [crit] 2519#2519: *5 connect() to unix:/home/seast/blog/blog.sock failed (13: Permission denied) while connecting to upstream, client: 85.68.32.122, server: 139.162.255.54, request: "GET /polls HTTP/1.1", upstream: "http://unix:/home/seast/blog/blog.sock:/polls", host: "139.162.255.54"
2021/06/25 12:26:04 [crit] 2519#2519: *9 connect() to unix:/home/seast/blog/blog.sock failed (13: Permission denied) while connecting to upstream, client: 80.82.77.192, server: 139.162.255.54, request: "GET / HTTP/1.1", upstream: "http://unix:/home/seast/blog/blog.sock:/", host: "139.162.255.54"
2021/06/25 12:31:57 [crit] 2519#2519: *11 connect() to unix:/home/seast/blog/blog.sock failed (13: Permission denied) while connecting to upstream, client: 85.68.32.122, server: 139.162.255.54, request: "GET / HTTP/1.1", upstream: "http://unix:/home/seast/blog/blog.sock:/", host: "139.162.255.54"
nginx/站点可用/博客
GNU nano 5.4 /etc/nginx/sites-available/blog
server {
listen 80;
server_name 139.162.255.54;
location = /favicon.ico { access_log off; log_not_found off; }
location /static/ {
root /home/seast/blog;
}
location / {
include proxy_params;
proxy_pass http://unix:/home/seast/blog/blog.sock;
}
}
GNU nano 5.4 /etc/systemd/system/gunicorn.service
[Unit]
Description=gunicorn daemon
After=network.target
[Service]
User=seast
Group=www-data
WorkingDirectory=/home/seast/blog
ExecStart=/home/seast/venv/bin/gunicorn --access-logfile - --workers 3 ->
[Install]
WantedBy=multi-user.target
解决方案
推荐阅读
- javascript - 当您有多个标记时,更改单击的标记图标
- javascript - 在 ReactJS 中获取 PHP 文件的回显
- javascript - FAQ 手风琴显示/隐藏
- angular - 通过在 Angular 应用程序的浏览器中手动输入其 URL 导航到特定页面(而不是根页面)并避免错误 404 (IIS)
- java - ActionListener 没有用 JButton 点击替换所需的面板
- java - 无法插入到 SQLite 数据库
- c++ - NS3-如何在模拟运行期间修改点对点通道数据速率
- html - 边距不当
- android - 如何在 android pie 或更高版本中运行后台操作?
- spring - 使用 JWT 调用资源服务器通过 Spring Cloud Gateway 返回 HTTP 403