Skip to content

Basic custom configuration settings e.g, extending Nginx timeout

kolorafa edited this page Jan 14, 2025 · 2 revisions

Here we group some basic related settings into a single file to be included when generating the Nginx configs.

In this case, we've grouped the settings for how long Nginx will wait for a connection/request timeout into a single extended_timeout.conf for development/debugging purposes:

RUN { \
      echo 'proxy_connect_timeout 300;'; \
      echo 'proxy_send_timeout 300;'; \
      echo 'proxy_read_timeout 300;'; \
      echo 'send_timeout 300;'; \
    } > /etc/nginx/conf.d/extended_timeout.conf

Or just mount the file on the fly without building the image

cat extended_timeout.conf

proxy_connect_timeout 300;
proxy_send_timeout 300;
proxy_read_timeout 300;
send_timeout 300;

Then for docker run:

docker run ... -v $(pwd)/extended_timeout.conf:/etc/nginx/conf.d/extended_timeout.conf

or for docker compose

volumes:
  - ./extended_timeout.conf:/etc/nginx/conf.d/extended_timeout.conf