小编ssg*_*hal的帖子

连接到上游时 Gunicorn Nginx 权限被拒绝

使用 gunicorn 和 nginx 设置 django 站点

项目的 gunicorn 设置:

[Unit]
Description=gunicorn daemon
After=network.target

[Service]
User=username
Group=nginx
WorkingDirectory=/home/username/my_project
ExecStart=/home/username/my_project/bin/gunicorn --access-logfile - --workers 3 --bind unix:/home/username/my_project/my_project.sock my_project.wsgi:application

[Install]
WantedBy=multi-user.target
Run Code Online (Sandbox Code Playgroud)

项目的 Nginx 配置文件:

user nginx;

server {
    listen       80;
        server_name  192.168.66.106;

        # Load configuration files for the default server block.
        include /etc/nginx/default.d/*.conf;

        location = /favicon.ico { access_log off; log_not_found off; }
        location /static {
            alias /home/username/my_project;
        }

        location / {
            proxy_set_header Host $http_host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header X-Forwarded-Proto $scheme; …
Run Code Online (Sandbox Code Playgroud)

nginx selinux gunicorn

6
推荐指数
1
解决办法
5074
查看次数

标签 统计

gunicorn ×1

nginx ×1

selinux ×1