From d6a2ea8510c0c9d45f56dc834e973d6a6f362075 Mon Sep 17 00:00:00 2001 From: Docker Library Bot Date: Tue, 24 Oct 2023 07:09:28 -0700 Subject: [PATCH] Run update.sh --- nginx/README.md | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/nginx/README.md b/nginx/README.md index 2dc72eb15..bd9085097 100644 --- a/nginx/README.md +++ b/nginx/README.md @@ -91,15 +91,11 @@ $ docker run --name some-nginx -d -p 8080:80 some-content-nginx Then you can hit `http://localhost:8080` or `http://host-ip:8080` in your browser. -## Complex configuration +## Customize configuration -```console -$ docker run --name my-custom-nginx-container -v /host/path/nginx.conf:/etc/nginx/nginx.conf:ro -d nginx -``` +You can mount your configuration file, or build a new image with it. -For information on the syntax of the nginx configuration files, see [the official documentation](http://nginx.org/en/docs/) (specifically the [Beginner's Guide](http://nginx.org/en/docs/beginners_guide.html#conf_structure)). - -If you wish to adapt the default configuration, use something like the following to copy it from a running nginx container: +If you wish to adapt the default configuration, use something like the following to get it from a running nginx container: ```console $ docker run --name tmp-nginx-container -d nginx @@ -107,7 +103,17 @@ $ docker cp tmp-nginx-container:/etc/nginx/nginx.conf /host/path/nginx.conf $ docker rm -f tmp-nginx-container ``` -This can also be accomplished more cleanly using a simple `Dockerfile` (in `/host/path/`): +And then edit `/host/path/nginx.conf` in your host file system. + +For information on the syntax of the nginx configuration files, see [the official documentation](http://nginx.org/en/docs/) (specifically the [Beginner's Guide](http://nginx.org/en/docs/beginners_guide.html#conf_structure)). + +### Mount your configuration file + +```console +$ docker run --name my-custom-nginx-container -v /host/path/nginx.conf:/etc/nginx/nginx.conf:ro -d nginx +``` + +### Build a new image with your configuration file ```dockerfile FROM nginx