some fixes and README update

This commit is contained in:
bunkerity 2020-09-29 23:37:07 +02:00
parent f3721a50db
commit 829c1c6974
3 changed files with 11 additions and 5 deletions

View File

@ -150,9 +150,9 @@ Default value : *no*
If set to yes, enables HTTP basic authentication at the location `AUTH_BASIC_LOCATION` with user `AUTH_BASIC_USER` and password `AUTH_BASIC_PASSWORD`.
`AUTH_BASIC_LOCATION`
Values : */* | */subdir/* | *\<any valid location\>*
Default value : */*
The location to restrict when `USE_AUTH_BASIC` is set to *yes*. By default, all the website is restricted (*/*).
Values : *sitewide* | */somedir* | *\<any valid location\>*
Default value : *sitewide*
The location to restrict when `USE_AUTH_BASIC` is set to *yes*. If the special value *sitewide* is used then auth basic will be set at server level outside any location context.
`AUTH_BASIC_USER`
Values : *\<any valid username\>*
@ -318,6 +318,11 @@ Values : *\<any valid IP/hostname\>*
Default value :
Set the IP/hostname address of a remote PHP-FPM to execute .php files. See `USE_PHP` if you want to run a PHP-FPM instance on the same container as bunkerized-nginx.
`REMOTE_PHP_PATH`
Values : *\<any valid absolute path\>*
Default value : */app*
The path where the PHP files are located inside the server specified in `REMOTE_PHP`.
`USE_PHP`
Values : *yes* | *no*
Default value : *yes*

View File

@ -68,7 +68,6 @@ http {
# lua path
lua_package_path "/usr/local/lib/lua/?.lua;;";
%DNSBL_CACHE%
lua_shared_dict dnsblcache 10m;
# server config
include /etc/nginx/server.conf;

View File

@ -38,7 +38,7 @@ function replace_in_file() {
function spaces_to_lua() {
for element in $1 ; do
if [ "$result" = "" ] ; then
result="$element"
result="\"${element}\""
else
result="${result}, \"${element}\""
fi
@ -71,6 +71,7 @@ GZIP_COMP_LEVEL="${GZIP_COMP_LEVEL-6}"
GZIP_MIN_LENGTH="${GZIP_MIN_LENGTH-10240}"
GZIP_TYPES="${GZIP_TYPES-text/css text/javascript text/xml text/plain text/x-component application/javascript application/x-javascript application/json application/xml application/rss+xml application/atom+xml font/truetype font/opentype application/vnd.ms-fontobject image/svg+xml}"
USE_PHP="${USE_PHP-yes}"
REMOTE_PHP_PATH="${REMOTE_PHP_PATH-/app}"
HEADER_SERVER="${HEADER_SERVER-no}"
X_FRAME_OPTIONS="${X_FRAME_OPTIONS-DENY}"
X_XSS_PROTECTION="${X_XSS_PROTECTION-1; mode=block}"
@ -177,6 +178,7 @@ if [ "$USE_PHP" = "yes" ] ; then
elif [ "$REMOTE_PHP" != "" ] ; then
replace_in_file "/etc/nginx/server.conf" "%USE_PHP%" "include /etc/nginx/php.conf;"
replace_in_file "/etc/nginx/php.conf" "%REMOTE_PHP%" "$REMOTE_PHP"
replace_in_file "/etc/nginx/fastcgi.conf" "\$document_root" "${REMOTE_PHP_PATH}/"
else
replace_in_file "/etc/nginx/server.conf" "%USE_PHP%" ""
fi