Apache 在只读 Docker 容器上为 mod_digest 共享内存

Apache 在只读 Docker 容器上为 mod_digest 共享内存

我正在使用以下参数运行 docker 容器;

docker run -d \
    -v "$(pwd)/data/logs:/logs" \
    -v "$(pwd)/data/auth:/auth" \
    -v "/mnt/data:/data" \
    -v "$(pwd)/data/dav.config:/usr/local/apache2/conf/dav.conf" \
        --memory="2g" \
        --cpu-shares=1024 \
        --read-only="true" \
        --tmpfs /tmp --tmpfs /run \
    --restart="always" \
    --name dav \
    dav

但是,当启动 httpd 时,我得到;

[Wed May 11 10:26:32.938887 2016] [auth_digest:notice] [pid 1:tid 139835054438272] AH01757: generating secret for digest authentication ...
[Wed May 11 10:26:32.939164 2016] [auth_digest:error] [pid 1:tid 139835054438272] (30)Read-only file system: AH01762: Failed to create shared memory segment on file /usr/local/apache2/logs/authdigest_shm.1
[Wed May 11 10:26:32.939194 2016] [auth_digest:error] [pid 1:tid 139835054438272] (30)Read-only file system: AH01760: failed to initialize shm - all nonce-count checking, one-time nonces, and MD5-sess algorithm disabled
[Wed May 11 10:26:32.939210 2016] [:emerg] [pid 1:tid 139835054438272] AH00020: Configuration Failed, exiting

我不知道任何指定位置的指令/usr/local/apache2/logs/authdigest_shm.1。/run 和 /tmp 是 tmpfs,其余的是只读的。有什么想法吗?

答案1

尝试改变DefaultRuntimeDir指令值

DefaultRuntimeDir指令设置服务器将在其中创建各种运行时文件(共享内存、锁等)的目录。如果设置为相对路径,则完整路径将相对于 ServerRoot

看:https://httpd.apache.org/docs/2.4/mod/core.html#defaultruntimedir

相关内容