{"id":17081053,"url":"https://github.com/expoli/nginx-proxy-docker-image-builder","last_synced_at":"2026-04-16T08:35:07.659Z","repository":{"id":55383474,"uuid":"326539652","full_name":"expoli/nginx-proxy-docker-image-builder","owner":"expoli","description":"nginx-proxy-docker-image Multi-platform","archived":false,"fork":false,"pushed_at":"2021-03-01T01:36:23.000Z","size":71,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-01-28T19:26:31.442Z","etag":null,"topics":["arm","arm64","docker","muti-platform","nginx-proxy"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/expoli.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-01-04T01:40:36.000Z","updated_at":"2024-02-14T14:40:48.000Z","dependencies_parsed_at":"2022-08-14T23:01:08.868Z","dependency_job_id":null,"html_url":"https://github.com/expoli/nginx-proxy-docker-image-builder","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/expoli%2Fnginx-proxy-docker-image-builder","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/expoli%2Fnginx-proxy-docker-image-builder/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/expoli%2Fnginx-proxy-docker-image-builder/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/expoli%2Fnginx-proxy-docker-image-builder/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/expoli","download_url":"https://codeload.github.com/expoli/nginx-proxy-docker-image-builder/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245104853,"owners_count":20561437,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["arm","arm64","docker","muti-platform","nginx-proxy"],"created_at":"2024-10-14T12:49:17.979Z","updated_at":"2026-04-16T08:35:07.621Z","avatar_url":"https://github.com/expoli.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# nginx-proxy-docker-image\n**nginx-proxy-docker-image, this image is based on `jwilder/nginx-proxy` I just rebuild it so that it can run on others platforms, such as `linux/amd64,linux/arm64/v8,linux/arm/v7,linux/arm/v6`**\n\n![latest 0.8.0](https://img.shields.io/badge/latest-0.8.0-green.svg?style=flat)\n![nginx 1.19.3](https://img.shields.io/badge/nginx-1.19.3-brightgreen.svg) ![License MIT](https://img.shields.io/badge/license-MIT-blue.svg) [![Build Status](https://travis-ci.org/tangcuyu/nginx-proxy.svg?branch=master)](https://travis-ci.org/tangcuyu/nginx-proxy) [![](https://img.shields.io/docker/stars/tangcuyu/nginx-proxy.svg)](https://hub.docker.com/r/tangcuyu/nginx-proxy 'DockerHub') [![](https://img.shields.io/docker/pulls/tangcuyu/nginx-proxy.svg)](https://hub.docker.com/r/tangcuyu/nginx-proxy 'DockerHub')\n\n\nnginx-proxy sets up a container running nginx and [docker-gen][1].  docker-gen generates reverse proxy configs for nginx and reloads nginx when containers are started and stopped.\n\nSee [Automated Nginx Reverse Proxy for Docker][2] for why you might want to use this.\n\n### Usage\n\nTo run it:\n\n    $ docker run -d -p 80:80 -v /var/run/docker.sock:/tmp/docker.sock:ro tangcuyu/nginx-proxy\n\nThen start any containers you want proxied with an env var `VIRTUAL_HOST=subdomain.youdomain.com`\n\n    $ docker run -e VIRTUAL_HOST=foo.bar.com  ...\n\nThe containers being proxied must [expose](https://docs.docker.com/engine/reference/run/#expose-incoming-ports) the port to be proxied, either by using the `EXPOSE` directive in their `Dockerfile` or by using the `--expose` flag to `docker run` or `docker create` and be in the same network. By default, if you don't pass the --net flag when your nginx-proxy container is created, it will only be attached to the default bridge network. This means that it will not be able to connect to containers on networks other than bridge.\n\nProvided your DNS is setup to forward foo.bar.com to the host running nginx-proxy, the request will be routed to a container with the VIRTUAL_HOST env var set.\n\n### Image variants\n\nThe nginx-proxy images are available in two flavors.\n\n#### tangcuyu/nginx-proxy:latest\n\nThis image uses the debian:jessie based nginx image.\n\n    $ docker pull tangcuyu/nginx-proxy:latest\n\n### Docker Compose\n\n```yaml\nversion: '2'\n\nservices:\n  nginx-proxy:\n    image: tangcuyu/nginx-proxy\n    ports:\n      - \"80:80\"\n    volumes:\n      - /var/run/docker.sock:/tmp/docker.sock:ro\n\n  whoami:\n    image: jwilder/whoami\n    environment:\n      - VIRTUAL_HOST=whoami.local\n```\n\n```shell\n$ docker-compose up\n$ curl -H \"Host: whoami.local\" localhost\nI'm 5b129ab83266\n```\n\n### IPv6 support\n\nYou can activate the IPv6 support for the nginx-proxy container by passing the value `true` to the `ENABLE_IPV6` environment variable:\n\n    $ docker run -d -p 80:80 -e ENABLE_IPV6=true -v /var/run/docker.sock:/tmp/docker.sock:ro tangcuyu/nginx-proxy\n\n### Multiple Ports\n\nIf your container exposes multiple ports, nginx-proxy will default to the service running on port 80.  If you need to specify a different port, you can set a VIRTUAL_PORT env var to select a different one.  If your container only exposes one port and it has a VIRTUAL_HOST env var set, that port will be selected.\n\n  [1]: https://github.com/jwilder/docker-gen\n  [2]: http://jasonwilder.com/blog/2014/03/25/automated-nginx-reverse-proxy-for-docker/\n\n### Multiple Hosts\n\nIf you need to support multiple virtual hosts for a container, you can separate each entry with commas.  For example, `foo.bar.com,baz.bar.com,bar.com` and each host will be setup the same.\n\n### Wildcard Hosts\n\nYou can also use wildcards at the beginning and the end of host name, like `*.bar.com` or `foo.bar.*`. Or even a regular expression, which can be very useful in conjunction with a wildcard DNS service like [xip.io](http://xip.io), using `~^foo\\.bar\\..*\\.xip\\.io` will match `foo.bar.127.0.0.1.xip.io`, `foo.bar.10.0.2.2.xip.io` and all other given IPs. More information about this topic can be found in the nginx documentation about [`server_names`](http://nginx.org/en/docs/http/server_names.html).\n\n### Multiple Networks\n\nWith the addition of [overlay networking](https://docs.docker.com/engine/userguide/networking/get-started-overlay/) in Docker 1.9, your `nginx-proxy` container may need to connect to backend containers on multiple networks. By default, if you don't pass the `--net` flag when your `nginx-proxy` container is created, it will only be attached to the default `bridge` network. This means that it will not be able to connect to containers on networks other than `bridge`.\n\nIf you want your `nginx-proxy` container to be attached to a different network, you must pass the `--net=my-network` option in your `docker create` or `docker run` command. At the time of this writing, only a single network can be specified at container creation time. To attach to other networks, you can use the `docker network connect` command after your container is created:\n\n```console\n$ docker run -d -p 80:80 -v /var/run/docker.sock:/tmp/docker.sock:ro \\\n    --name my-nginx-proxy --net my-network tangcuyu/nginx-proxy\n$ docker network connect my-other-network my-nginx-proxy\n```\n\nIn this example, the `my-nginx-proxy` container will be connected to `my-network` and `my-other-network` and will be able to proxy to other containers attached to those networks.\n\n### Internet vs. Local Network Access\n\nIf you allow traffic from the public internet to access your `nginx-proxy` container, you may want to restrict some containers to the internal network only, so they cannot be accessed from the public internet.  On containers that should be restricted to the internal network, you should set the environment variable `NETWORK_ACCESS=internal`.  By default, the *internal* network is defined as `127.0.0.0/8, 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16`.  To change the list of networks considered internal, mount a file on the `nginx-proxy` at `/etc/nginx/network_internal.conf` with these contents, edited to suit your needs:\n\n```\n# These networks are considered \"internal\"\nallow 127.0.0.0/8;\nallow 10.0.0.0/8;\nallow 192.168.0.0/16;\nallow 172.16.0.0/12;\n\n# Traffic from all other networks will be rejected\ndeny all;\n```\n\nWhen internal-only access is enabled, external clients with be denied with an `HTTP 403 Forbidden`\n\n\u003e If there is a load-balancer / reverse proxy in front of `nginx-proxy` that hides the client IP (example: AWS Application/Elastic Load Balancer), you will need to use the nginx `realip` module (already installed) to extract the client's IP from the HTTP request headers.  Please see the [nginx realip module configuration](http://nginx.org/en/docs/http/ngx_http_realip_module.html) for more details.  This configuration can be added to a new config file and mounted in `/etc/nginx/conf.d/`.\n\n### SSL Backends\n\nIf you would like the reverse proxy to connect to your backend using HTTPS instead of HTTP, set `VIRTUAL_PROTO=https` on the backend container.\n\n\u003e Note: If you use `VIRTUAL_PROTO=https` and your backend container exposes port 80 and 443, `nginx-proxy` will use HTTPS on port 80.  This is almost certainly not what you want, so you should also include `VIRTUAL_PORT=443`.\n\n### uWSGI Backends\n\nIf you would like to connect to uWSGI backend, set `VIRTUAL_PROTO=uwsgi` on the\nbackend container. Your backend container should then listen on a port rather\nthan a socket and expose that port.\n\n### FastCGI Backends\n \nIf you would like to connect to FastCGI backend, set `VIRTUAL_PROTO=fastcgi` on the\nbackend container. Your backend container should then listen on a port rather\nthan a socket and expose that port.\n \n### FastCGI File Root Directory\n\nIf you use fastcgi,you can set `VIRTUAL_ROOT=xxx`  for your root directory\n\n\n### Default Host\n\nTo set the default host for nginx use the env var `DEFAULT_HOST=foo.bar.com` for example\n\n    $ docker run -d -p 80:80 -e DEFAULT_HOST=foo.bar.com -v /var/run/docker.sock:/tmp/docker.sock:ro tangcuyu/nginx-proxy\n\n\n### Separate Containers\n\nnginx-proxy can also be run as two separate containers using the [jwilder/docker-gen](https://hub.docker.com/r/jwilder/docker-gen)\nimage and the official [nginx](https://registry.hub.docker.com/_/nginx/) image.\n\nYou may want to do this to prevent having the docker socket bound to a publicly exposed container service.\n\nYou can demo this pattern with docker-compose:\n\n```console\n$ docker-compose --file docker-compose-separate-containers.yml up\n$ curl -H \"Host: whoami.local\" localhost\nI'm 5b129ab83266\n```\n\nTo run nginx proxy as a separate container you'll need to have [nginx.tmpl](https://github.com/jwilder/nginx-proxy/blob/master/nginx.tmpl) on your host system.\n\nFirst start nginx with a volume:\n\n\n    $ docker run -d -p 80:80 --name nginx -v /tmp/nginx:/etc/nginx/conf.d -t nginx\n\nThen start the docker-gen container with the shared volume and template:\n\n```\n$ docker run --volumes-from nginx \\\n    -v /var/run/docker.sock:/tmp/docker.sock:ro \\\n    -v $(pwd):/etc/docker-gen/templates \\\n    -t jwilder/docker-gen -notify-sighup nginx -watch /etc/docker-gen/templates/nginx.tmpl /etc/nginx/conf.d/default.conf\n```\n\nFinally, start your containers with `VIRTUAL_HOST` environment variables.\n\n    $ docker run -e VIRTUAL_HOST=foo.bar.com  ...\n### SSL Support using letsencrypt\n\n[letsencrypt-nginx-proxy-companion](https://github.com/JrCs/docker-letsencrypt-nginx-proxy-companion) is a lightweight companion container for the nginx-proxy. It allows the creation/renewal of Let's Encrypt certificates automatically.\n\nSet `DHPARAM_GENERATION` environment variable to `false` to disabled Diffie-Hellman parameters completely. This will also ignore auto-generation made by `nginx-proxy`.\nThe default value is `true`\n\n     $ docker run -e DHPARAM_GENERATION=false ....\n### SSL Support\n\nSSL is supported using single host, wildcard and SNI certificates using naming conventions for\ncertificates or optionally specifying a cert name (for SNI) as an environment variable.\n\nTo enable SSL:\n\n    $ docker run -d -p 80:80 -p 443:443 -v /path/to/certs:/etc/nginx/certs -v /var/run/docker.sock:/tmp/docker.sock:ro tangcuyu/nginx-proxy\n\nThe contents of `/path/to/certs` should contain the certificates and private keys for any virtual\nhosts in use.  The certificate and keys should be named after the virtual host with a `.crt` and\n`.key` extension.  For example, a container with `VIRTUAL_HOST=foo.bar.com` should have a\n`foo.bar.com.crt` and `foo.bar.com.key` file in the certs directory.\n\nIf you are running the container in a virtualized environment (Hyper-V, VirtualBox, etc...),\n/path/to/certs must exist in that environment or be made accessible to that environment.\nBy default, Docker is not able to mount directories on the host machine to containers running in a virtual machine.\n\n#### Diffie-Hellman Groups\n\nDiffie-Hellman groups are enabled by default, with a pregenerated key in `/etc/nginx/dhparam/dhparam.pem`.\nYou can mount a different `dhparam.pem` file at that location to override the default cert.\nTo use custom `dhparam.pem` files per-virtual-host, the files should be named after the virtual host with a\n`dhparam` suffix and `.pem` extension. For example, a container with `VIRTUAL_HOST=foo.bar.com`\nshould have a `foo.bar.com.dhparam.pem` file in the `/etc/nginx/certs` directory.\n\n\u003e NOTE: If you don't mount a `dhparam.pem` file at `/etc/nginx/dhparam/dhparam.pem`, one will be generated\nat startup.  Since it can take minutes to generate a new `dhparam.pem`, it is done at low priority in the\nbackground.  Once generation is complete, the `dhparam.pem` is saved on a persistent volume and nginx\nis reloaded.  This generation process only occurs the first time you start `nginx-proxy`.\n\n\u003e COMPATIBILITY WARNING: The default generated `dhparam.pem` key is 2048 bits for A+ security.  Some\n\u003e older clients (like Java 6 and 7) do not support DH keys with over 1024 bits.  In order to support these\n\u003e clients, you must either provide your own `dhparam.pem`, or tell `nginx-proxy` to generate a 1024-bit\n\u003e key on startup by passing `-e DHPARAM_BITS=1024`.\n\nIn the separate container setup, no pregenerated key will be available and neither the\n[jwilder/docker-gen](https://hub.docker.com/r/jwilder/docker-gen) image nor the offical\n[nginx](https://registry.hub.docker.com/_/nginx/) image will generate one. If you still want A+ security\nin a separate container setup, you'll have to generate a 2048 bits DH key file manually and mount it on the\nnginx container, at `/etc/nginx/dhparam/dhparam.pem`.\n\n#### Wildcard Certificates\n\nWildcard certificates and keys should be named after the domain name with a `.crt` and `.key` extension.\nFor example `VIRTUAL_HOST=foo.bar.com` would use cert name `bar.com.crt` and `bar.com.key`.\n\n#### SNI\n\nIf your certificate(s) supports multiple domain names, you can start a container with `CERT_NAME=\u003cname\u003e`\nto identify the certificate to be used.  For example, a certificate for `*.foo.com` and `*.bar.com`\ncould be named `shared.crt` and `shared.key`.  A container running with `VIRTUAL_HOST=foo.bar.com`\nand `CERT_NAME=shared` will then use this shared cert.\n\n#### OCSP Stapling\nTo enable OCSP Stapling for a domain, `nginx-proxy` looks for a PEM certificate containing the trusted\nCA certificate chain at `/etc/nginx/certs/\u003cdomain\u003e.chain.pem`, where `\u003cdomain\u003e` is the domain name in\nthe `VIRTUAL_HOST` directive.  The format of this file is a concatenation of the public PEM CA\ncertificates starting with the intermediate CA most near the SSL certificate, down to the root CA.  This is\noften referred to as the \"SSL Certificate Chain\".  If found, this filename is passed to the NGINX\n[`ssl_trusted_certificate` directive](http://nginx.org/en/docs/http/ngx_http_ssl_module.html#ssl_trusted_certificate)\nand OCSP Stapling is enabled.\n\n#### How SSL Support Works\n\nThe default SSL cipher configuration is based on the [Mozilla intermediate profile](https://wiki.mozilla.org/Security/Server_Side_TLS#Intermediate_compatibility_.28recommended.29) version 5.0 which\nshould provide compatibility with clients back to Firefox 27, Android 4.4.2, Chrome 31, Edge, IE 11 on Windows 7,\nJava 8u31, OpenSSL 1.0.1, Opera 20, and Safari 9.  Note that the DES-based TLS ciphers were removed for security.\nThe configuration also enables HSTS, PFS, OCSP stapling and SSL session caches.  Currently TLS 1.2 and 1.3\nare supported.\n\nIf you don't require backward compatibility, you can use the [Mozilla modern profile](https://wiki.mozilla.org/Security/Server_Side_TLS#Modern_compatibility)\nprofile instead by including the environment variable `SSL_POLICY=Mozilla-Modern` to the nginx-proxy container or to your container.\nThis profile is compatible with clients back to Firefox 63, Android 10.0, Chrome 70, Edge 75, Java 11,\nOpenSSL 1.1.1, Opera 57, and Safari 12.1.  Note that this profile is **not** compatible with any version of Internet Explorer.\n\nOther policies available through the `SSL_POLICY` environment variable are [`Mozilla-Old`](https://wiki.mozilla.org/Security/Server_Side_TLS#Old_backward_compatibility)\nand the [AWS ELB Security Policies](https://docs.aws.amazon.com/elasticloadbalancing/latest/classic/elb-security-policy-table.html)\n`AWS-TLS-1-2-2017-01`, `AWS-TLS-1-1-2017-01`, `AWS-2016-08`, `AWS-2015-05`, `AWS-2015-03` and `AWS-2015-02`.\n\nNote that the `Mozilla-Old` policy should use a 1024 bits DH key for compatibility but this container generates\na 2048 bits key. The [Diffie-Hellman Groups](#diffie-hellman-groups) section details different methods of bypassing\nthis, either globally or per virtual-host.\n\nThe default behavior for the proxy when port 80 and 443 are exposed is as follows:\n\n* If a container has a usable cert, port 80 will redirect to 443 for that container so that HTTPS\nis always preferred when available.\n* If the container does not have a usable cert, a 503 will be returned.\n\nNote that in the latter case, a browser may get an connection error as no certificate is available\nto establish a connection.  A self-signed or generic cert named `default.crt` and `default.key`\nwill allow a client browser to make a SSL connection (likely w/ a warning) and subsequently receive\na 500.\n\nTo serve traffic in both SSL and non-SSL modes without redirecting to SSL, you can include the\nenvironment variable `HTTPS_METHOD=noredirect` (the default is `HTTPS_METHOD=redirect`).  You can also\ndisable the non-SSL site entirely with `HTTPS_METHOD=nohttp`, or disable the HTTPS site with\n`HTTPS_METHOD=nohttps`. `HTTPS_METHOD` can be specified on each container for which you want to\noverride the default behavior or on the proxy container to set it globally. If `HTTPS_METHOD=noredirect` is used, Strict Transport Security (HSTS)\nis disabled to prevent HTTPS users from being redirected by the client.  If you cannot get to the HTTP\nsite after changing this setting, your browser has probably cached the HSTS policy and is automatically\nredirecting you back to HTTPS.  You will need to clear your browser's HSTS cache or use an incognito\nwindow / different browser.\n\nBy default, [HTTP Strict Transport Security (HSTS)](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Strict-Transport-Security) \nis enabled with `max-age=31536000` for HTTPS sites.  You can disable HSTS with the environment variable \n`HSTS=off` or use a custom HSTS configuration like `HSTS=max-age=31536000; includeSubDomains; preload`.  \n*WARNING*: HSTS will force your users to visit the HTTPS version of your site for the `max-age` time - \neven if they type in `http://` manually.  The only way to get to an HTTP site after receiving an HSTS \nresponse is to clear your browser's HSTS cache.\n\n### Basic Authentication Support\n\nIn order to be able to secure your virtual host, you have to create a file named as its equivalent VIRTUAL_HOST variable on directory\n/etc/nginx/htpasswd/$VIRTUAL_HOST\n\n```\n$ docker run -d -p 80:80 -p 443:443 \\\n    -v /path/to/htpasswd:/etc/nginx/htpasswd \\\n    -v /path/to/certs:/etc/nginx/certs \\\n    -v /var/run/docker.sock:/tmp/docker.sock:ro \\\n    tangcuyu/nginx-proxy\n```\n\nYou'll need apache2-utils on the machine where you plan to create the htpasswd file. Follow these [instructions](http://httpd.apache.org/docs/2.2/programs/htpasswd.html)\n\n### Custom Nginx Configuration\n\nIf you need to configure Nginx beyond what is possible using environment variables, you can provide custom configuration files on either a proxy-wide or per-`VIRTUAL_HOST` basis.\n\n#### Replacing default proxy settings\n\nIf you want to replace the default proxy settings for the nginx container, add a configuration file at `/etc/nginx/proxy.conf`. A file with the default settings would\nlook like this:\n\n```Nginx\n# HTTP 1.1 support\nproxy_http_version 1.1;\nproxy_buffering off;\nproxy_set_header Host $http_host;\nproxy_set_header Upgrade $http_upgrade;\nproxy_set_header Connection $proxy_connection;\nproxy_set_header X-Real-IP $remote_addr;\nproxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;\nproxy_set_header X-Forwarded-Proto $proxy_x_forwarded_proto;\nproxy_set_header X-Forwarded-Ssl $proxy_x_forwarded_ssl;\nproxy_set_header X-Forwarded-Port $proxy_x_forwarded_port;\n\n# Mitigate httpoxy attack (see README for details)\nproxy_set_header Proxy \"\";\n```\n\n***NOTE***: If you provide this file it will replace the defaults; you may want to check the .tmpl file to make sure you have all of the needed options.\n\n***NOTE***: The default configuration blocks the `Proxy` HTTP request header from being sent to downstream servers.  This prevents attackers from using the so-called [httpoxy attack](http://httpoxy.org).  There is no legitimate reason for a client to send this header, and there are many vulnerable languages / platforms (`CVE-2016-5385`, `CVE-2016-5386`, `CVE-2016-5387`, `CVE-2016-5388`, `CVE-2016-1000109`, `CVE-2016-1000110`, `CERT-VU#797896`).\n\n#### Proxy-wide\n\nTo add settings on a proxy-wide basis, add your configuration file under `/etc/nginx/conf.d` using a name ending in `.conf`.\n\nThis can be done in a derived image by creating the file in a `RUN` command or by `COPY`ing the file into `conf.d`:\n\n```Dockerfile\nFROM tangcuyu/nginx-proxy\nRUN { \\\n      echo 'server_tokens off;'; \\\n      echo 'client_max_body_size 100m;'; \\\n    } \u003e /etc/nginx/conf.d/my_proxy.conf\n```\n\nOr it can be done by mounting in your custom configuration in your `docker run` command:\n\n    $ docker run -d -p 80:80 -p 443:443 -v /path/to/my_proxy.conf:/etc/nginx/conf.d/my_proxy.conf:ro -v /var/run/docker.sock:/tmp/docker.sock:ro tangcuyu/nginx-proxy\n\n#### Per-VIRTUAL_HOST\n\nTo add settings on a per-`VIRTUAL_HOST` basis, add your configuration file under `/etc/nginx/vhost.d`. Unlike in the proxy-wide case, which allows multiple config files with any name ending in `.conf`, the per-`VIRTUAL_HOST` file must be named exactly after the `VIRTUAL_HOST`.\n\nIn order to allow virtual hosts to be dynamically configured as backends are added and removed, it makes the most sense to mount an external directory as `/etc/nginx/vhost.d` as opposed to using derived images or mounting individual configuration files.\n\nFor example, if you have a virtual host named `app.example.com`, you could provide a custom configuration for that host as follows:\n\n    $ docker run -d -p 80:80 -p 443:443 -v /path/to/vhost.d:/etc/nginx/vhost.d:ro -v /var/run/docker.sock:/tmp/docker.sock:ro tangcuyu/nginx-proxy\n    $ { echo 'server_tokens off;'; echo 'client_max_body_size 100m;'; } \u003e /path/to/vhost.d/app.example.com\n\nIf you are using multiple hostnames for a single container (e.g. `VIRTUAL_HOST=example.com,www.example.com`), the virtual host configuration file must exist for each hostname. If you would like to use the same configuration for multiple virtual host names, you can use a symlink:\n\n    $ { echo 'server_tokens off;'; echo 'client_max_body_size 100m;'; } \u003e /path/to/vhost.d/www.example.com\n    $ ln -s /path/to/vhost.d/www.example.com /path/to/vhost.d/example.com\n\n#### Per-VIRTUAL_HOST default configuration\n\nIf you want most of your virtual hosts to use a default single configuration and then override on a few specific ones, add those settings to the `/etc/nginx/vhost.d/default` file. This file\nwill be used on any virtual host which does not have a `/etc/nginx/vhost.d/{VIRTUAL_HOST}` file associated with it.\n\n#### Per-VIRTUAL_HOST location configuration\n\nTo add settings to the \"location\" block on a per-`VIRTUAL_HOST` basis, add your configuration file under `/etc/nginx/vhost.d`\njust like the previous section except with the suffix `_location`.\n\nFor example, if you have a virtual host named `app.example.com` and you have configured a proxy_cache `my-cache` in another custom file, you could tell it to use a proxy cache as follows:\n\n    $ docker run -d -p 80:80 -p 443:443 -v /path/to/vhost.d:/etc/nginx/vhost.d:ro -v /var/run/docker.sock:/tmp/docker.sock:ro tangcuyu/nginx-proxy\n    $ { echo 'proxy_cache my-cache;'; echo 'proxy_cache_valid  200 302  60m;'; echo 'proxy_cache_valid  404 1m;' } \u003e /path/to/vhost.d/app.example.com_location\n\nIf you are using multiple hostnames for a single container (e.g. `VIRTUAL_HOST=example.com,www.example.com`), the virtual host configuration file must exist for each hostname. If you would like to use the same configuration for multiple virtual host names, you can use a symlink:\n\n    $ { echo 'proxy_cache my-cache;'; echo 'proxy_cache_valid  200 302  60m;'; echo 'proxy_cache_valid  404 1m;' } \u003e /path/to/vhost.d/app.example.com_location\n    $ ln -s /path/to/vhost.d/www.example.com /path/to/vhost.d/example.com\n\n#### Per-VIRTUAL_HOST location default configuration\n\nIf you want most of your virtual hosts to use a default single `location` block configuration and then override on a few specific ones, add those settings to the `/etc/nginx/vhost.d/default_location` file. This file\nwill be used on any virtual host which does not have a `/etc/nginx/vhost.d/{VIRTUAL_HOST}_location` file associated with it.\n\n### Contributing\n\nBefore submitting pull requests or issues, please check github to make sure an existing issue or pull request is not already open.\n\n#### Running Tests Locally\n\nTo run tests, you need to prepare the docker image to test which must be tagged `jwilder/nginx-proxy:test`:\n\n    docker build -t jwilder/nginx-proxy:test .  # build the Debian variant image\n\nand call the [test/pytest.sh](test/pytest.sh) script.\n\nThen build the Alpine variant of the image:\n\n    docker build -f Dockerfile.alpine -t jwilder/nginx-proxy:test .  # build the Alpline variant image\n\nand call the [test/pytest.sh](test/pytest.sh) script again.\n\n\nIf your system has the `make` command, you can automate those tasks by calling:\n\n    make test\n\n\nYou can learn more about how the test suite works and how to write new tests in the [test/README.md](test/README.md) file.\n\n### Need help?\n\nIf you have questions on how to use the image, please ask them on the [Q\u0026A Group](https://groups.google.com/forum/#!forum/nginx-proxy)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fexpoli%2Fnginx-proxy-docker-image-builder","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fexpoli%2Fnginx-proxy-docker-image-builder","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fexpoli%2Fnginx-proxy-docker-image-builder/lists"}