Skip to content

How to disable cache? #2618

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
agostop opened this issue May 10, 2025 · 5 comments
Closed

How to disable cache? #2618

agostop opened this issue May 10, 2025 · 5 comments

Comments

@agostop
Copy link

agostop commented May 10, 2025

So many error log like "1235 mkdir() "/var/cache/nginx/proxy_temp/9/58" failed (28: No space left on device) while reading upstream",
I must remove the container that can reslove it.

Are there have some environment variables to control this?

@buchdag
Copy link
Member

buchdag commented May 11, 2025

Hi.

Could you please provide a bit more context on this issue ?

  • what version of nginx-proxy are you using ?
  • what is your nginx-proxy setup ? Could you provide a docker compose file ?
  • "I must remove the container that can reslove it." : which container are you talking about ?
  • "are there have some environment variables to control this?" : to control what ? 🤔

@agostop
Copy link
Author

agostop commented May 12, 2025

@buchdag
thank you for reply.

what version of nginx-proxy are you using ?
I'm using the latest version of nginx-proxy.

what is your nginx-proxy setup ? Could you provide a docker compose file ?
I use nginx-proxy with acme-companion, I really like this combination, the compose file like blow:

services:
  nginx-proxy:
    image: nginxproxy/nginx-proxy
    container_name: nginx-proxy
    ports:
      - "20443:443"
    volumes:
      # The vhost and conf volumes are only required
      # if you plan to obtain standalone certificates
      - ./vhost:/etc/nginx/vhost.d
      # - conf:/etc/nginx/conf.d
      - ./html:/usr/share/nginx/html
      - ./certs:/etc/nginx/certs:ro
      - /var/run/docker.sock:/tmp/docker.sock:ro
    networks:
      - docker_internal

  acme-companion:
    image: nginxproxy/acme-companion
    container_name: nginx-proxy-acme
    environment:
      DEFAULT_EMAIL: [email protected]
      ACME_CHALLENGE: DNS-01
      ACMESH_DNS_API_CONFIG: |-
          DNS_API: dns_cf
          CF_Token: xxx
          CF_Zone_ID: xxx
          CF_Account_ID: xxx
    volumes_from:
      - nginx-proxy
    volumes:
      - ./certs:/etc/nginx/certs:rw
      - ./acme:/etc/acme.sh
      - /var/run/docker.sock:/var/run/docker.sock:ro
    networks:
      - docker_internal

"I must remove the container that can reslove it." : which container are you talking about ?
I often use this to provide file download service, after a while, my server's disk will be full. After my investigation, it was caused by the nginx-proxy container, I found the volumn of nginx-proxy using 80% disk space, so I used 'docker-compose stop nginx-proxy && docker-compose rm nginx-proxy && docker-compose up -d', then disk usage has returned to normal.

"are there have some environment variables to control this?" : to control what ?
I mean, is there an environment variable that can control this disk cache function?

@buchdag
Copy link
Member

buchdag commented May 12, 2025

Looks like the culprit in your case is proxy_buffering.

It was enabled by default a while back because nginx strongly discourage disabling it for most use cases.

There is no builtin environment variable to enable or disable proxy buffering but you can easily do this at the proxy of virtual host level with custom configurations.

Just mount a file ending in .conf inside /etc/nginx/conf.d, containing the following:

proxy_buffering off;

and proxy buffering will be disabled at the proxy level.

@agostop
Copy link
Author

agostop commented May 13, 2025

okay, emmm, have you considered implementing this functionality using built-in environment variable?

Looks like the culprit in your case is proxy_buffering.

It was enabled by default a while back because nginx strongly discourage disabling it for most use cases.

There is no builtin environment variable to enable or disable proxy buffering but you can easily do this at the proxy of virtual host level with custom configurations.

Just mount a file ending in .conf inside /etc/nginx/conf.d, containing the following:

proxy_buffering off;
and proxy buffering will be disabled at the proxy level.

@buchdag
Copy link
Member

buchdag commented May 13, 2025

As there is already a way to do it, no that's not planned.

@agostop agostop closed this as completed May 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants