diff --git a/Dockerfile b/Dockerfile index 5f68e35..572d4a6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -19,7 +19,7 @@ COPY logs/ /opt/logs COPY lua/ /opt/lua COPY crowdsec/ /opt/crowdsec -RUN apk --no-cache add certbot libstdc++ libmaxminddb geoip pcre yajl fail2ban clamav apache2-utils rsyslog openssl lua libgd go jq mariadb-connector-c bash && \ +RUN apk --no-cache add certbot libstdc++ libmaxminddb geoip pcre yajl fail2ban clamav apache2-utils rsyslog openssl lua libgd go jq mariadb-connector-c bash brotli && \ chmod +x /opt/entrypoint/* /opt/scripts/* && \ mkdir /opt/entrypoint.d && \ rm -f /var/log/nginx/* && \ diff --git a/Dockerfile-amd64 b/Dockerfile-amd64 index 6c330e9..1c1bbce 100644 --- a/Dockerfile-amd64 +++ b/Dockerfile-amd64 @@ -19,7 +19,7 @@ COPY logs/ /opt/logs COPY lua/ /opt/lua COPY crowdsec/ /opt/crowdsec -RUN apk --no-cache add certbot libstdc++ libmaxminddb geoip pcre yajl fail2ban clamav apache2-utils rsyslog openssl lua libgd go jq mariadb-connector-c bash && \ +RUN apk --no-cache add certbot libstdc++ libmaxminddb geoip pcre yajl fail2ban clamav apache2-utils rsyslog openssl lua libgd go jq mariadb-connector-c bash brotli && \ chmod +x /opt/entrypoint/* /opt/scripts/* && \ mkdir /opt/entrypoint.d && \ rm -f /var/log/nginx/* && \ diff --git a/Dockerfile-arm32v7 b/Dockerfile-arm32v7 index 482f8e7..89a89d7 100644 --- a/Dockerfile-arm32v7 +++ b/Dockerfile-arm32v7 @@ -26,7 +26,7 @@ COPY logs/ /opt/logs COPY lua/ /opt/lua COPY crowdsec/ /opt/crowdsec -RUN apk --no-cache add certbot libstdc++ libmaxminddb geoip pcre yajl fail2ban clamav apache2-utils rsyslog openssl lua libgd go jq mariadb-connector-c bash && \ +RUN apk --no-cache add certbot libstdc++ libmaxminddb geoip pcre yajl fail2ban clamav apache2-utils rsyslog openssl lua libgd go jq mariadb-connector-c bash brotli && \ chmod +x /opt/entrypoint/* /opt/scripts/* && \ mkdir /opt/entrypoint.d && \ rm -f /var/log/nginx/* && \ diff --git a/Dockerfile-arm64v8 b/Dockerfile-arm64v8 index 9f769af..b50e26c 100644 --- a/Dockerfile-arm64v8 +++ b/Dockerfile-arm64v8 @@ -26,7 +26,7 @@ COPY logs/ /opt/logs COPY lua/ /opt/lua COPY crowdsec/ /opt/crowdsec -RUN apk --no-cache add certbot libstdc++ libmaxminddb geoip pcre yajl fail2ban clamav apache2-utils rsyslog openssl lua libgd go jq mariadb-connector-c bash && \ +RUN apk --no-cache add certbot libstdc++ libmaxminddb geoip pcre yajl fail2ban clamav apache2-utils rsyslog openssl lua libgd go jq mariadb-connector-c bash brotli && \ chmod +x /opt/entrypoint/* /opt/scripts/* && \ mkdir /opt/entrypoint.d && \ rm -f /var/log/nginx/* && \ diff --git a/Dockerfile-i386 b/Dockerfile-i386 index 8620238..ac3109f 100644 --- a/Dockerfile-i386 +++ b/Dockerfile-i386 @@ -19,7 +19,7 @@ COPY logs/ /opt/logs COPY lua/ /opt/lua COPY crowdsec/ /opt/crowdsec -RUN apk --no-cache add certbot libstdc++ libmaxminddb geoip pcre yajl fail2ban clamav apache2-utils rsyslog openssl lua libgd go jq mariadb-connector-c bash && \ +RUN apk --no-cache add certbot libstdc++ libmaxminddb geoip pcre yajl fail2ban clamav apache2-utils rsyslog openssl lua libgd go jq mariadb-connector-c bash brotli && \ chmod +x /opt/entrypoint/* /opt/scripts/* && \ mkdir /opt/entrypoint.d && \ rm -f /var/log/nginx/* && \ diff --git a/compile.sh b/compile.sh index a961d2c..808dabf 100644 --- a/compile.sh +++ b/compile.sh @@ -30,7 +30,7 @@ function git_secure_clone() { NTASK=$(nproc) # install build dependencies -apk add --no-cache --virtual build autoconf libtool automake git geoip-dev yajl-dev g++ curl-dev libxml2-dev pcre-dev make linux-headers libmaxminddb-dev musl-dev lua-dev gd-dev gnupg +apk add --no-cache --virtual build autoconf libtool automake git geoip-dev yajl-dev g++ curl-dev libxml2-dev pcre-dev make linux-headers libmaxminddb-dev musl-dev lua-dev gd-dev gnupg brotli-dev # compile and install ModSecurity library cd /tmp diff --git a/confs/global/nginx.conf b/confs/global/nginx.conf index 700b254..6afd9ab 100644 --- a/confs/global/nginx.conf +++ b/confs/global/nginx.conf @@ -47,9 +47,6 @@ http { include /etc/nginx/mime.types; default_type application/octet-stream; - # load gzip custom config - include /etc/nginx/gzip.conf; - # maximum request body size client_max_body_size %MAX_CLIENT_SIZE%; diff --git a/entrypoint/defaults.sh b/entrypoint/defaults.sh index 4801fd2..7ec494b 100644 --- a/entrypoint/defaults.sh +++ b/entrypoint/defaults.sh @@ -4,7 +4,7 @@ HTTP_PORT="${HTTP_PORT-8080}" HTTPS_PORT="${HTTPS_PORT-8443}" MAX_CLIENT_SIZE="${MAX_CLIENT_SIZE-10m}" SERVER_TOKENS="${SERVER_TOKENS-off}" -USE_CLIENT_CACHE="${USE_CLIENT_CACHE-yes}" +USE_CLIENT_CACHE="${USE_CLIENT_CACHE-no}" CLIENT_CACHE_EXTENSIONS="${CLIENT_CACHE_EXTENSIONS-jpg|jpeg|png|bmp|ico|svg|tif|css|js|otf|ttf|eot|woff|woff2}" CLIENT_CACHE_CONTROL="${CLIENT_CACHE_CONTROL-public, max-age=15552000}" CLIENT_CACHE_ETAG="${CLIENT_CACHE_ETAG-on}" diff --git a/entrypoint/site-config.sh b/entrypoint/site-config.sh index 95b8412..1fa3fcd 100644 --- a/entrypoint/site-config.sh +++ b/entrypoint/site-config.sh @@ -37,7 +37,7 @@ else fi # client caching -if [ "$USE_CLIENT_CACHE" = "yes" ] ; +if [ "$USE_CLIENT_CACHE" = "yes" ] ; then replace_in_file "${NGINX_PREFIX}server.conf" "%USE_CLIENT_CACHE%" "include ${NGINX_PREFIX}client-cache.conf;" replace_in_file "${NGINX_PREFIX}client-cache.conf" "%CLIENT_CACHE_EXTENSIONS%" "$CLIENT_CACHE_EXTENSIONS" replace_in_file "${NGINX_PREFIX}client-cache.conf" "%CLIENT_CACHE_ETAG%" "$CLIENT_CACHE_ETAG" diff --git a/examples/basic-website-with-php/docker-compose.yml b/examples/basic-website-with-php/docker-compose.yml index 4615b2b..d3d6431 100644 --- a/examples/basic-website-with-php/docker-compose.yml +++ b/examples/basic-website-with-php/docker-compose.yml @@ -16,6 +16,7 @@ services: - AUTO_LETS_ENCRYPT=yes - REDIRECT_HTTP_TO_HTTPS=yes - DISABLE_DEFAULT_SERVER=yes + - USE_CLIENT_CACHE=yes - REMOTE_PHP=myphp - REMOTE_PHP_PATH=/app diff --git a/examples/load-balancer/server-confs/reverse-proxy.conf b/examples/load-balancer/server-confs/reverse-proxy.conf index d0842d1..93ac5e2 100644 --- a/examples/load-balancer/server-confs/reverse-proxy.conf +++ b/examples/load-balancer/server-confs/reverse-proxy.conf @@ -2,5 +2,5 @@ proxy_set_header Host $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; location / { - proxy_pass http://app$request_uri; + proxy_pass http://app; } diff --git a/examples/moodle/server-confs/reverse-proxy.conf b/examples/moodle/server-confs/reverse-proxy.conf index bd2236d..5cac16a 100644 --- a/examples/moodle/server-confs/reverse-proxy.conf +++ b/examples/moodle/server-confs/reverse-proxy.conf @@ -2,7 +2,5 @@ proxy_set_header Host $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; location / { - if ($host = www.website.com) { - proxy_pass http://mymoodle:8443$request_uri; - } + proxy_pass https://mymoodle:8443; } diff --git a/examples/multisite-basic/docker-compose.yml b/examples/multisite-basic/docker-compose.yml index d695452..549c4b0 100644 --- a/examples/multisite-basic/docker-compose.yml +++ b/examples/multisite-basic/docker-compose.yml @@ -18,11 +18,13 @@ services: - AUTO_LETS_ENCRYPT=yes - REDIRECT_HTTP_TO_HTTPS=yes - DISABLE_DEFAULT_SERVER=yes + - USE_CLIENT_CACHE=yes - app1.website.com_REMOTE_PHP=myapp1 - app1.website.com_REMOTE_PHP_PATH=/app - app2.website.com_REMOTE_PHP=myapp2 - app2.website.com_REMOTE_PHP_PATH=/app - app3.website.com_SERVE_FILES=no + - app3.website.com_USE_CLIENT_CACHE=no networks: - net1 - net2 diff --git a/examples/multisite-basic/server-confs/app3.website.com/reverse-proxy.conf b/examples/multisite-basic/server-confs/app3.website.com/reverse-proxy.conf index 73d8a82..6f43f7f 100644 --- a/examples/multisite-basic/server-confs/app3.website.com/reverse-proxy.conf +++ b/examples/multisite-basic/server-confs/app3.website.com/reverse-proxy.conf @@ -2,5 +2,5 @@ proxy_set_header Host $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; location / { - proxy_pass http://myapp3:3000$request_uri; + proxy_pass http://myapp3:3000; } diff --git a/examples/multisite-complex/docker-compose.yml b/examples/multisite-complex/docker-compose.yml index 9ec84f2..3619e36 100644 --- a/examples/multisite-complex/docker-compose.yml +++ b/examples/multisite-complex/docker-compose.yml @@ -20,6 +20,7 @@ services: - AUTO_LETS_ENCRYPT=yes - REDIRECT_HTTP_TO_HTTPS=yes - DISABLE_DEFAULT_SERVER=yes + - USE_CLIENT_CACHE=yes - wp.website.com_REMOTE_PHP=mywp - wp.website.com_REMOTE_PHP_PATH=/var/www/html - nc.website.com_REMOTE_PHP=mync diff --git a/examples/nextcloud/docker-compose.yml b/examples/nextcloud/docker-compose.yml index 7cf5775..318bb8c 100644 --- a/examples/nextcloud/docker-compose.yml +++ b/examples/nextcloud/docker-compose.yml @@ -20,6 +20,7 @@ services: - REDIRECT_HTTP_TO_HTTPS=yes - DISABLE_DEFAULT_SERVER=yes - MAX_CLIENT_SIZE=10G + - USE_CLIENT_CACHE=yes - REMOTE_PHP=mync - REMOTE_PHP_PATH=/var/www/html - LIMIT_REQ_RATE=40r/s diff --git a/examples/passbolt/server-confs/reverse-proxy.conf b/examples/passbolt/server-confs/reverse-proxy.conf index ca036f2..50a1b13 100644 --- a/examples/passbolt/server-confs/reverse-proxy.conf +++ b/examples/passbolt/server-confs/reverse-proxy.conf @@ -2,8 +2,6 @@ proxy_set_header Host $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; location / { - if ($host = www.website.com) { - proxy_pass https://mypassbolt:443$request_uri; - } + proxy_pass https://mypassbolt; } diff --git a/examples/reverse-proxy/server-confs/reverse-proxy.conf b/examples/reverse-proxy/server-confs/reverse-proxy.conf index d89ca56..1aa4fa2 100644 --- a/examples/reverse-proxy/server-confs/reverse-proxy.conf +++ b/examples/reverse-proxy/server-confs/reverse-proxy.conf @@ -3,10 +3,10 @@ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; location / { if ($host = app1.website.com) { - proxy_pass http://app1:3000$request_uri; + proxy_pass http://app1:3000; } if ($host = app2.website.com) { - proxy_pass http://app2$request_uri; + proxy_pass http://app2; } } diff --git a/examples/tomcat/server-confs/reverse-proxy.conf b/examples/tomcat/server-confs/reverse-proxy.conf index fb6434d..564193a 100644 --- a/examples/tomcat/server-confs/reverse-proxy.conf +++ b/examples/tomcat/server-confs/reverse-proxy.conf @@ -2,5 +2,5 @@ proxy_set_header Host $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; location / { - proxy_pass http://mytomcat:8080/sample$request_uri; + proxy_pass http://mytomcat:8080/sample; } diff --git a/examples/tor-hidden-service/docker-compose.yml b/examples/tor-hidden-service/docker-compose.yml index c8e371e..5764788 100644 --- a/examples/tor-hidden-service/docker-compose.yml +++ b/examples/tor-hidden-service/docker-compose.yml @@ -27,6 +27,7 @@ services: - USE_BLACKLIST_IP=no - USE_BLACKLIST_REVERSE=no - USE_FAIL2BAN=no + - USE_CLIENT_CACHE=yes - REMOTE_PHP=myphp - REMOTE_PHP_PATH=/app diff --git a/examples/wordpress/docker-compose.yml b/examples/wordpress/docker-compose.yml index 86f2fcd..f158ae2 100644 --- a/examples/wordpress/docker-compose.yml +++ b/examples/wordpress/docker-compose.yml @@ -19,6 +19,7 @@ services: - REDIRECT_HTTP_TO_HTTPS=yes - DISABLE_DEFAULT_SERVER=yes - MAX_CLIENT_SIZE=50m + - USE_CLIENT_CACHE=yes - REMOTE_PHP=mywp - REMOTE_PHP_PATH=/var/www/html