Put your config files (nginx.conf etc.) inside a folder, for example: ~/nginx-config.
Then run the container:
docker run --name nginx --net host --restart always -v $HOME/nginx-config:/usr/src/docker-nginx/conf:ro -d bohan/nginx:1.17.7
You must mount the config dir to this specific /usr/src/docker-nginx/conf path!
Your existing config files will replace default config files.
You can even change your configuration after the container start and apply them without any downtime.
After change, run the command:
docker exec nginx docker-nginx-reload.sh
This docker-nginx-reload.sh script will test your new configuration and reload the server. It will rollback if the test fails.
Add these in the top‑level (main) context of your nginx.conf configuration file (not within the http or stream context):
load_module /usr/lib/nginx/modules/ngx_http_brotli_filter_module.so;
load_module /usr/lib/nginx/modules/ngx_http_brotli_static_module.so;
load_module /usr/lib/nginx/modules/ngx_http_geoip2_module.so;
Content type
Image
Digest
Size
13.5 MB
Last updated
almost 6 years ago
docker pull bohan/nginx