diff --git a/README.md b/README.md index d55cd39..f34f2f1 100644 --- a/README.md +++ b/README.md @@ -143,6 +143,23 @@ 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. +#### Overriding default proxy settings + +If you want to override 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; +``` + #### 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`. diff --git a/nginx.tmpl b/nginx.tmpl index b4140f9..fba5e74 100644 --- a/nginx.tmpl +++ b/nginx.tmpl @@ -38,6 +38,9 @@ log_format vhost '$host $remote_addr - $remote_user [$time_local] ' access_log /proc/self/fd/1 vhost; error_log /proc/self/fd/2; +{{ if (exists "/etc/nginx/proxy.conf") }} +include /etc/nginx/proxy.conf; +{{ else }} # HTTP 1.1 support proxy_http_version 1.1; proxy_buffering off; @@ -47,6 +50,7 @@ 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; +{{ end }} server { server_name _; # This is just an invalid value which will never trigger on a real hostname.