1
0
mirror of https://github.com/thib8956/nginx-proxy synced 2025-07-02 06:45:45 +00:00

Merge pull request #215 from gradecam/feature/customize_improvements

customizability improvements
This commit is contained in:
Jason Wilder
2015-09-12 15:23:53 -06:00
2 changed files with 64 additions and 1 deletions

View File

@ -37,6 +37,9 @@ log_format vhost '$host $remote_addr - $remote_user [$time_local] '
access_log off;
{{ if (exists "/etc/nginx/proxy.conf") }}
include /etc/nginx/proxy.conf;
{{ else }}
# HTTP 1.1 support
proxy_http_version 1.1;
proxy_buffering off;
@ -46,6 +49,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.
@ -134,6 +138,8 @@ server {
{{ if (exists (printf "/etc/nginx/vhost.d/%s" $host)) }}
include {{ printf "/etc/nginx/vhost.d/%s" $host }};
{{ else if (exists "/etc/vhost.d/default") }}
include /etc/nginx/vhost.d/default;
{{ end }}
location / {
@ -142,6 +148,11 @@ server {
auth_basic "Restricted {{ $host }}";
auth_basic_user_file {{ (printf "/etc/nginx/htpasswd/%s" $host) }};
{{ end }}
{{ if (exists (printf "/etc/nginx/vhost.d/%s_location" $host)) }}
include {{ printf "/etc/nginx/vhost.d/%s_location" $host}};
{{ else if (exists "/etc/vhost.d/default_location") }}
include /etc/nginx/vhost.d/default_location;
{{ end }}
}
}
{{ else }}
@ -153,6 +164,8 @@ server {
{{ if (exists (printf "/etc/nginx/vhost.d/%s" $host)) }}
include {{ printf "/etc/nginx/vhost.d/%s" $host }};
{{ else if (exists "/etc/vhost.d/default") }}
include /etc/nginx/vhost.d/default;
{{ end }}
location / {
@ -161,6 +174,11 @@ server {
auth_basic "Restricted {{ $host }}";
auth_basic_user_file {{ (printf "/etc/nginx/htpasswd/%s" $host) }};
{{ end }}
{{ if (exists (printf "/etc/nginx/vhost.d/%s_location" $host)) }}
include {{ printf "/etc/nginx/vhost.d/%s_location" $host}};
{{ else if (exists "/etc/vhost.d/default_location") }}
include /etc/nginx/vhost.d/default_location;
{{ end }}
}
}