【发布时间】:2018-01-05 14:21:23
【问题描述】:
尝试使用 nginx 代理 gunicorn 套接字。
/etc/systemd/system/gunicorn.service文件
[Unit]
Description=gunicorn daemon
After=network.target
[Service]
User=www-data
Group=www-data
WorkingDirectory=/root/PSite/blog
ExecStart=/root/PSite/blog/blog/venv/bin/gunicorn --access-logfile - --workers 3 --bind unix:/root/PSite/blog/blog.sock blog.wsgi:application
[Install]
WantedBy=multi-user.target
/etc/nginx/sites-available/blog文件
server {
listen 80;
server_name server_domain_or_IP;
location = /favicon.ico { access_log off; log_not_found off; }
location /static/ {
root /root/PSite/blog;
}
location / {
include proxy_params;
proxy_pass http://unix:/root/PSite/blog/blog.sock;
}
}
然后我启动守护进程:systemctl start gunicorn
运行systemctl status gunicorn 后会抛出错误:
EXEC 生成 /root/PSite/blog/blog/venv/bin/gunicorn:权限被拒绝
所有文件夹和文件归 www-data:www-data 所有。
如果我将 gunicorn 用户更改为 root 它会创建代理,但 nginx 日志显示它没有权限。
有什么问题?
【问题讨论】:
标签: sockets nginx permissions gunicorn systemd