【发布时间】:2021-09-30 09:44:30
【问题描述】:
我正在尝试使用 uwsgi 和 docker 在生产服务器上获取 django 应用程序。在生产服务器上启动了 nginx,但没有为 uwsgi 配置。我使用没有虚拟环境的 pip 将 uwsgi 安装到 docker 中。但是,当我尝试使用 django 应用程序提供服务时,我得到uwsgi_master_fifo()/mkfifo(): Permission denied [core/fifo.c line 112]。
我的 uwsgi.ini:
[uwsgi]
http-socket = :8000
chmod-socket = 777
chdir = /api/
module = MenStore.wsgi:application
static-map = /staticfiles=static
master = true
processes = 4
offload-threads = 4
vacuum = true
harakiri = 30
max-requests = 10000
stats = :9191
memory-report = true
enable-threads = true
logger = internalservererror file:/tmp/uwsgi-errors.log
post-buffering = 1
buffer-size = 16383
uid = 1000
gid = 1000
touch-reload = uwsgi-reload
master-fifo = uwsgi-fifo
我的 django 应用服务到 docker-compose 文件中:
api: &api
build:
context: Backend
dockerfile: Dockerfile
ports:
- "8000:8000"
volumes:
- "/root/MenStore/media/:/api/media/:rw"
command: uwsgi --ini /api/uwsgi.ini
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_started
【问题讨论】:
-
/root/MenStore/media的所有权是什么?因为您的 uwsgi 将以 uid/gid 1000 运行。因此,如果该用户无法在该挂载中写入,您将得到这个。 -
如果我删除这一行,什么都不会改变。我也遇到同样的错误。
标签: python django docker docker-compose uwsgi