linux - 如何在 docker 实例中关闭 sendfile

标签 linux nginx configuration docker sendfile

我有一个正在运行的 nginx docker 实例。在 docker 实例中有一个名为 /etc/nginx/nginx.conf

它有以下设置

http {
    include       /etc/nginx/mime.types;
    default_type  application/octet-stream;

    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" 

    access_log  /var/log/nginx/access.log  main;

    sendfile        on;
    ....
}

我通过运行以下命令来运行 docker 实例。

docker run -d -P -v /Users/user/site:/usr/share/nginx/html --name mysite nginx

我将如何运行上述命令,但要更改配置设置以关闭 sendfile?

answer looks similar to mine .我需要创建一个构建文件吗?我有点困惑。

最佳答案

只需将您自己的配置文件作为 volume 注入(inject)即可.

假设您在/tmp 中有一个 conf 文件,那么您可以使用以下命令运行容器:

docker run -d -P -v /tmp/my.conf:/etc/nginx/nginx.conf -v /Users/user/site:/usr/share/nginx/html --name mysite nginx

关于linux - 如何在 docker 实例中关闭 sendfile,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30925884/

相关文章:

C++通过命令行使用*字符传递多个文件

linux - 我想在 Debian 8 上安装 Mono 5.0.0

static - Nginx image_filter

nginx - 使用 Nginx 和 uWSGI 服务器发送事件

linux - 小鬼 : symbol lookup error : undefined symbol sldext

linux - Nginx:如何查看哪些文件处于下载状态?

Wordpress get_template_directory() 在具有相同数据库的本地主机和开发服务器上工作

testing - Protractor 测试的动态浏览器分辨率

python - ".directory"在家里可以接受吗?

linux - UDP 连接被拒绝