Django swagger ui 在 nginx 上无法访问

Django swagger ui not accessible on nginx

我已经按照以下 url.

使用 nginx、gunicorn 和 postgres 设置了 Django

https://www.digitalocean.com/community/tutorials/how-to-set-up-django-with-postgres-nginx-and-gunicorn-on-centos-7

现在我正在尝试访问 swagger ui。

Nginx 已启动,运行正在显示默认页面。

当我运行使用同一个项目时, python manage.py 运行 服务器 myip:8000 然后访问相同的 url 我可以看到带有其余端点的实际招摇 ui。 我不确定我在这里做错了什么。

这是我添加到 nginx 文件中的内容。

server {
        listen 80;
        server_name <myipaddress>;

        location = /favicon.ico { access_log off; log_not_found off; }
        location /static/ {
            root /home/threat-dashboard/backend;
        }

        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;
            proxy_pass http://unix:/tmp/backend.sock;
        }
    }

sock 文件路径有误。我将其从 /tmp/backend.sock 更正为 /tmp/backend/backend.sock 并解决了问题。