mirror of
https://github.com/thib8956/nginx-proxy
synced 2024-11-22 03:46:29 +00:00
Add support for overriding default proxy settings
- If /etc/nginx/proxy.conf exists use that, otherwise use the default
This commit is contained in:
parent
23ae831198
commit
2eff96969a
17
README.md
17
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.
|
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
|
#### 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`.
|
To add settings on a proxy-wide basis, add your configuration file under `/etc/nginx/conf.d` using a name ending in `.conf`.
|
||||||
|
@ -38,6 +38,9 @@ log_format vhost '$host $remote_addr - $remote_user [$time_local] '
|
|||||||
access_log /proc/self/fd/1 vhost;
|
access_log /proc/self/fd/1 vhost;
|
||||||
error_log /proc/self/fd/2;
|
error_log /proc/self/fd/2;
|
||||||
|
|
||||||
|
{{ if (exists "/etc/nginx/proxy.conf") }}
|
||||||
|
include /etc/nginx/proxy.conf;
|
||||||
|
{{ else }}
|
||||||
# HTTP 1.1 support
|
# HTTP 1.1 support
|
||||||
proxy_http_version 1.1;
|
proxy_http_version 1.1;
|
||||||
proxy_buffering off;
|
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-Real-IP $remote_addr;
|
||||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
proxy_set_header X-Forwarded-Proto $proxy_x_forwarded_proto;
|
proxy_set_header X-Forwarded-Proto $proxy_x_forwarded_proto;
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
server {
|
server {
|
||||||
server_name _; # This is just an invalid value which will never trigger on a real hostname.
|
server_name _; # This is just an invalid value which will never trigger on a real hostname.
|
||||||
|
Loading…
Reference in New Issue
Block a user