reverse proxy support via env vars
This commit is contained in:
parent
8f7cb5318e
commit
0f18e9c552
7
confs/site/reverse-proxy.conf
Normal file
7
confs/site/reverse-proxy.conf
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
proxy_set_header Host $host;
|
||||||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
|
||||||
|
location %REVERSE_PROXY_URL% {
|
||||||
|
proxy_pass %REVERSE_PROXY_LOCATION%;
|
||||||
|
}
|
||||||
@ -38,4 +38,5 @@ server {
|
|||||||
server_tokens %SERVER_TOKENS%;
|
server_tokens %SERVER_TOKENS%;
|
||||||
%USE_OPEN_FILE_CACHE%
|
%USE_OPEN_FILE_CACHE%
|
||||||
%USE_PROXY_CACHE%
|
%USE_PROXY_CACHE%
|
||||||
|
%USE_REVERSE_PROXY%
|
||||||
}
|
}
|
||||||
|
|||||||
@ -31,6 +31,7 @@ BROTLI_COMP_LEVEL="${BROTLI_COMP_LEVEL-6}"
|
|||||||
BROTLI_MIN_LENGTH="${BROTLI_MIN_LENGTH-1000}"
|
BROTLI_MIN_LENGTH="${BROTLI_MIN_LENGTH-1000}"
|
||||||
BROTLI_TYPES="${BROTLI_TYPES-application/atom+xml application/javascript application/json application/rss+xml application/vnd.ms-fontobject application/x-font-opentype application/x-font-truetype application/x-font-ttf application/x-javascript application/xhtml+xml application/xml font/eot font/opentype font/otf font/truetype image/svg+xml image/vnd.microsoft.icon image/x-icon image/x-win-bitmap text/css text/javascript text/plain text/xml}"
|
BROTLI_TYPES="${BROTLI_TYPES-application/atom+xml application/javascript application/json application/rss+xml application/vnd.ms-fontobject application/x-font-opentype application/x-font-truetype application/x-font-ttf application/x-javascript application/xhtml+xml application/xml font/eot font/opentype font/otf font/truetype image/svg+xml image/vnd.microsoft.icon image/x-icon image/x-win-bitmap text/css text/javascript text/plain text/xml}"
|
||||||
REMOTE_PHP_PATH="${REMOTE_PHP_PATH-/app}"
|
REMOTE_PHP_PATH="${REMOTE_PHP_PATH-/app}"
|
||||||
|
USE_REVERSE_PROXY="${USE_REVERSE_PROXY-no}"
|
||||||
HEADER_SERVER="${HEADER_SERVER-no}"
|
HEADER_SERVER="${HEADER_SERVER-no}"
|
||||||
X_FRAME_OPTIONS="${X_FRAME_OPTIONS-DENY}"
|
X_FRAME_OPTIONS="${X_FRAME_OPTIONS-DENY}"
|
||||||
X_XSS_PROTECTION="${X_XSS_PROTECTION-1; mode=block}"
|
X_XSS_PROTECTION="${X_XSS_PROTECTION-1; mode=block}"
|
||||||
|
|||||||
@ -32,7 +32,7 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# proxy_cache zone
|
# proxy_cache zone
|
||||||
if [ "$USE_PROXY_CACHE" = "yes" ] ; then
|
if [ "$(has_value USE_PROXY_CACHE yes)" = "yes" ] ; then
|
||||||
replace_in_file "/etc/nginx/nginx.conf" "%PROXY_CACHE_PATH%" "proxy_cache_path /tmp/proxy_cache keys_zone=proxycache:${PROXY_CACHE_PATH_ZONE_SIZE} ${PROXY_CACHE_PATH_PARAMS};"
|
replace_in_file "/etc/nginx/nginx.conf" "%PROXY_CACHE_PATH%" "proxy_cache_path /tmp/proxy_cache keys_zone=proxycache:${PROXY_CACHE_PATH_ZONE_SIZE} ${PROXY_CACHE_PATH_PARAMS};"
|
||||||
else
|
else
|
||||||
replace_in_file "/etc/nginx/nginx.conf" "%PROXY_CACHE_PATH%" ""
|
replace_in_file "/etc/nginx/nginx.conf" "%PROXY_CACHE_PATH%" ""
|
||||||
|
|||||||
@ -42,6 +42,16 @@ replace_in_file "{NGINX_PREFIX}server.conf" "%MAX_CLIENT_SIZE%" "$MAX_CLIENT_SIZ
|
|||||||
# server tokens
|
# server tokens
|
||||||
replace_in_file "{NGINX_PREFIX}server.conf" "%SERVER_TOKENS%" "$SERVER_TOKENS"
|
replace_in_file "{NGINX_PREFIX}server.conf" "%SERVER_TOKENS%" "$SERVER_TOKENS"
|
||||||
|
|
||||||
|
# reverse proxy
|
||||||
|
if [ "$USE_REVERSE_PROXY" = "yes" ] ; then
|
||||||
|
replace_in_file "${NGINX_PREFIX}server.conf" "%USE_REVERSE_PROXY%" "include ${NGINX_PREFIX}reverse-proxy.conf"
|
||||||
|
replace_in_file "${NGINX_PREFIX}reverse-proxy.conf" "%REVERSE_PROXY_URL%" "$REVERSE_PROXY_URL"
|
||||||
|
replace_in_file "${NGINX_PREFIX}reverse-proxy.conf" "%REVERSE_PROXY_HOST%" "$REVERSE_PROXY_HOST"
|
||||||
|
|
||||||
|
else
|
||||||
|
replace_in_file "${NGINX_PREFIX}server.conf" "%USE_REVERSE_PROXY%" ""
|
||||||
|
fi
|
||||||
|
|
||||||
# proxy caching
|
# proxy caching
|
||||||
if [ "$USE_PROXY_CACHE" = "yes" ] ; then
|
if [ "$USE_PROXY_CACHE" = "yes" ] ; then
|
||||||
replace_in_file "${NGINX_PREFIX}server.conf" "%USE_PROXY_CACHE%" "include ${NGINX_PREFIX}proxy-cache.conf;"
|
replace_in_file "${NGINX_PREFIX}server.conf" "%USE_PROXY_CACHE%" "include ${NGINX_PREFIX}proxy-cache.conf;"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user