|
@@ -140,6 +140,25 @@ You'll need apache2-utils on the machine where you plan to create the htpasswd f
|
|
|
|
|
|
If 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.
|
|
|
|
|
|
+#### Replacing default proxy settings
|
|
|
+
|
|
|
+If 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
|
|
|
+look like this:
|
|
|
+
|
|
|
+```Nginx
|
|
|
+# HTTP 1.1 support
|
|
|
+proxy_http_version 1.1;
|
|
|
+proxy_buffering off;
|
|
|
+proxy_set_header Host $http_host;
|
|
|
+proxy_set_header Upgrade $http_upgrade;
|
|
|
+proxy_set_header Connection $proxy_connection;
|
|
|
+proxy_set_header X-Real-IP $remote_addr;
|
|
|
+proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
|
+proxy_set_header X-Forwarded-Proto $proxy_x_forwarded_proto;
|
|
|
+```
|
|
|
+
|
|
|
+***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.
|
|
|
+
|
|
|
#### Proxy-wide
|
|
|
|
|
|
To add settings on a proxy-wide basis, add your configuration file under `/etc/nginx/conf.d` using a name ending in `.conf`.
|
|
@@ -172,4 +191,30 @@ For example, if you have a virtual host named `app.example.com`, you could provi
|
|
|
If 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:
|
|
|
|
|
|
$ { echo 'server_tokens off;'; echo 'client_max_body_size 100m;'; } > /path/to/vhost.d/www.example.com
|
|
|
- $ ln -s www.example.com /path/to/vhost.d/example.com
|
|
|
+ $ ln -s /path/to/vhost.d/www.example.com /path/to/vhost.d/example.com
|
|
|
+
|
|
|
+#### Per-VIRTUAL_HOST default configuration
|
|
|
+
|
|
|
+If 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
|
|
|
+will be used on any virtual host which does not have a `/etc/nginx/vhost.d/{VIRTUAL_HOST}` file associated with it.
|
|
|
+
|
|
|
+#### Per-VIRTUAL_HOST location configuration
|
|
|
+
|
|
|
+To add settings to the "location" block on a per-`VIRTUAL_HOST` basis, add your configuration file under `/etc/nginx/vhost.d`
|
|
|
+just like the previous section except with the suffix `_location`.
|
|
|
+
|
|
|
+For 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:
|
|
|
+
|
|
|
+ $ 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 jwilder/nginx-proxy
|
|
|
+ $ { echo 'proxy_cache my-cache;'; echo 'proxy_cache_valid 200 302 60m;'; echo 'proxy_cache_valid 404 1m;' } > /path/to/vhost.d/app.example.com_location
|
|
|
+
|
|
|
+If 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:
|
|
|
+
|
|
|
+ $ { echo 'proxy_cache my-cache;'; echo 'proxy_cache_valid 200 302 60m;'; echo 'proxy_cache_valid 404 1m;' } > /path/to/vhost.d/app.example.com_location
|
|
|
+ $ ln -s /path/to/vhost.d/www.example.com /path/to/vhost.d/example.com
|
|
|
+
|
|
|
+#### Per-VIRTUAL_HOST location default configuration
|
|
|
+
|
|
|
+If 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
|
|
|
+will be used on any virtual host which does not have a `/etc/nginx/vhost.d/{VIRTUAL_HOST}` file associated with it.
|
|
|
+
|