Bunkerized-Nginx - Nginx Docker Image Secure By Default
2020-11-26 20:30:00 Author: www.blogger.com(查看原文) 阅读量:199 收藏

tag:blogger.com,1999:blog-8317222231133660547.post-10721370380891314352020-11-26T08:30:00.012-03:002020-11-26T08:30:03.492-03:00Bunkerized-Nginx - Nginx Docker Image Secure By Default<div class="separator" style="clear: both; text-align: center;"><a href="https://1.bp.blogspot.com/-_dNj-zGfDHk/X78n1Cm44uI/AAAAAAAAUeU/p01vT0T8LacScDWE6GMQZEmVdNoJ1zk-gCNcBGAsYHQ/s594/bunkerized-nginx_1_logo.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="594" data-original-width="578" height="400" src="https://1.bp.blogspot.com/-_dNj-zGfDHk/X78n1Cm44uI/AAAAAAAAUeU/p01vT0T8LacScDWE6GMQZEmVdNoJ1zk-gCNcBGAsYHQ/w389-h400/bunkerized-nginx_1_logo.png" width="389" /></a></div><p><br /></p> <p>nginx Docker image secure by default.</p> <p>Avoid the hassle of following security best practices each time you need a web server or reverse proxy. Bunkerized-nginx provides generic security configs, settings and tools so you don't need to do it yourself.</p><span><a name='more'></a></span><p><br /></p> <p>Non-exhaustive list of features :</p> <ul> <li>HTTPS support with transparent Let's Encrypt automation</li> <li>State-of-the-art web security : HTTP security headers, prevent leaks, TLS hardening, ...</li> <li>Integrated <a href="https://www.kitploit.com/search/label/ModSecurity" target="_blank" title="ModSecurity">ModSecurity</a> WAF with the OWASP Core Rule Set</li> <li>Automatic ban of strange behaviors with fail2ban</li> <li>Antibot challenge through cookie, javascript, captcha or recaptcha v3</li> <li>Block TOR, proxies, bad user-agents, countries, ...</li> <li>Block known bad IP with DNSBL and CrowdSec</li> <li>Prevent <a href="https://www.kitploit.com/search/label/Bruteforce%20Attacks" target="_blank" title="bruteforce attacks">bruteforce attacks</a> with rate limiting</li> <li>Detect bad files with ClamAV</li> <li>Easy to configure with environment variables</li> </ul> <p>Fooling automated tools/scanners :</p><p><br /></p><div class="separator" style="clear: both; text-align: center;"><a href="https://1.bp.blogspot.com/-kSXvDtAb2kM/X78oCWOs3iI/AAAAAAAAUeY/GwFIqhKAMCAd1q6AvQ6BdUNKIcdwOLiJwCNcBGAsYHQ/s694/bunkerized-nginx_7_demo.gif" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="604" data-original-width="694" height="558" src="https://1.bp.blogspot.com/-kSXvDtAb2kM/X78oCWOs3iI/AAAAAAAAUeY/GwFIqhKAMCAd1q6AvQ6BdUNKIcdwOLiJwCNcBGAsYHQ/w640-h558/bunkerized-nginx_7_demo.gif" width="640" /></a></div><p><br /></p><span style="font-size: x-large;"><b>Live demo</b></span><br /> <p>You can find a live demo at <a href="https://demo-nginx.bunkerity.com" rel="nofollow" target="_blank" title="https://demo-nginx.bunkerity.com">https://demo-nginx.bunkerity.com</a>.</p> <br /><span style="font-size: x-large;"><b>Quickstart guide</b></span><br /> <br /><span style="font-size: large;"><b>Run HTTP server with default settings</b></span><br /> <div><pre><code>docker run -p 80:8080 -v /path/to/web/files:/www:ro bunkerity/bunkerized-nginx</code></pre></div> <p>Web files are stored in the /www directory, the container will serve files from there.</p> <br /><span style="font-size: large;"><b>In combination with PHP</b></span><br /> <div><pre><code>docker network create mynet<br />docker run --network mynet \<br /> -p 80:8080 \<br /> -v /path/to/web/files:/www:ro \<br /> -e REMOTE_PHP=myphp \<br /> -e REMOTE_PHP_PATH=/app \<br /> bunkerity/bunkerized-nginx<br />docker run --network mynet \<br /> --name=myphp \<br /> -v /path/to/web/files:/app \<br /> php:fpm</code></pre></div> <p>The <code>REMOTE_PHP</code> environment variable lets you define the address of a remote PHP-FPM instance that will execute the .php files. <code>REMOTE_PHP_PATH</code> must be set to the directory where the PHP container will find the files.</p> <br /><span style="font-size: large;"><b>Run HTTPS server with automated Let's Encrypt</b></span><br /> <div><pre><code>docker run -p 80:8080 \<br /> -p 443:8443 \<br /> -v /path/to/web/files:/www:ro \<br /> -v /where/to/save/certificates:/etc/letsencrypt \<br /> -e SERVER_NAME=www.yourdomain.com \<br /> -e AUTO_LETS_ENCRYPT=yes \<br /> -e REDIRECT_HTTP_TO_HTTPS=yes \<br /> bunkerity/bunkerized-nginx</code></pre></div> <p>Certificates are stored in the /etc/letsencrypt directory, you should save it on your local drive.<br /> If you don't want your webserver to listen on HTTP add the environment variable <code>LISTEN_HTTP</code> with a <em>no</em> value. But Let's Encrypt needs the port 80 to be opened so redirecting the port is mandatory.</p> <p>Here you have three environment variables :</p> <ul> <li><code>SERVER_NAME</code> : define the FQDN of your webserver, this is mandatory for Let's Encrypt (<a href="http://www.yourdomain.com" rel="nofollow" target="_blank" title="www.yourdomain.com">www.yourdomain.com</a> should point to your IP address)</li> <li><code>AUTO_LETS_ENCRYPT</code> : enable automatic Let's Encrypt creation and renewal of certificates</li> <li><code>REDIRECT_HTTP_TO_HTTPS</code> : enable HTTP to HTTPS redirection</li> </ul> <br /><span style="font-size: large;"><b>As a reverse proxy</b></span><br /> <div><pre><code>docker run -p 80:8080 \<br /> -e USE_REVERSE_PROXY=yes \<br /> -e REVERSE_PROXY_URL=/ \<br /> -e REVERSE_PROXY_HOST=http://myserver:8080 \<br /> bunkerity/bunkerized-nginx</code></pre></div> <p>This is a simple reverse proxy to a unique application. If you have more than one application you can add more REVERSE_PROXY_URL/REVERSE_PROXY_HOST by appending a suffix number like this :</p> <div><pre><code>docker run -p 80:8080 \<br /> -e USE_REVERSE_PROXY=yes \<br /> -e REVERSE_PROXY_URL_1=/app1/ \<br /> -e REVERSE_PROXY_HOST_1=http://myapp1:3000/ \<br /> -e REVERSE_PROXY_URL_2=/app2/ \<br /> -e REVERSE_PROXY_HOST_2=http://myapp2:3000/ \<br /> bunkerity/bunkerized-nginx</code></pre></div> <br /><span style="font-size: large;"><b>Behind a reverse proxy</b></span><br /> <div><pre><code>docker run -p 80:8080 \<br /> -v /path/to/web/files:/www \<br /> -e PROXY_REAL_IP=yes \<br /> bunkerity/bunkerized-nginx</code></pre></div> <p>The <code>PROXY_REAL_IP</code> environment variable, when set to <em>yes</em>, activates the <a href="https://nginx.org/en/docs/http/ngx_http_realip_module.html" rel="nofollow" target="_blank" title="ngx_http_realip_module">ngx_http_realip_module</a> to get the real client IP from the reverse proxy.</p> <p>See <a href="https://github.com/bunkerity/bunkerized-nginx#reverse-proxy" rel="nofollow" target="_blank" title="this section">this section</a> if you need to tweak some values (trusted ip/network, header, ...).</p> <br /><span style="font-size: large;"><b>Multisite</b></span><br /> <p>By default, bunkerized-nginx will only create one server block. When setting the <code>MULTISITE</code> environment variable to <em>yes</em>, one server block will be created for each host defined in the <code>SERVER_NAME</code> environment variable.<br /> You can set/override values for a specific server by prefixing the environment variable with one of the server name previously defined.</p> <div><pre><code>docker run -p 80:8080 \<br /> -p 443:8443 \<br /> -v /where/to/save/certificates:/etc/letsencrypt \<br /> -e SERVER_NAME=app1.domain.com app2.domain.com \<br /> -e MULTISITE=yes \<br /> -e AUTO_LETS_ENCRYPT=yes \<br /> -e REDIRECT_HTTP_TO_HTTPS=yes \<br /> -e USE_REVERSE_PROXY=yes \<br /> -e app1.domain.com_PROXY_URL=/ \<br /> -e app1.domain.com_PROXY_HOST=http://myapp1:8000 \<br /> -e app2.domain.com_PROXY_URL=/ \<br /> -e app2.domain.com_PROXY_HOST=http://myapp2:8000 \<br /> bunkerity/bunkerized-nginx</code></pre></div> <p>The <code>USE_REVERSE_PROXY</code> is a <em>global</em> variable that will be applied to each server block. Whereas the <code>app1.domain.com_*</code> and <code>app2.domain.com_*</code> will only be applied to the app1.domain.com and app2.domain.com server block respectively.</p> <p>When serving files, the web root directory should contains subdirectories named as the servers defined in the <code>SERVER_NAME</code> environment variable. Here is an example :</p> <div><pre><code>docker run -p 80:8080 \<br /> -p 443:8443 \<br /> -v /where/to/save/certificates:/etc/letsencrypt \<br /> -v /where/are/web/files:/www:ro \<br /> -e SERVER_NAME=app1.domain.com app2.domain.com \<br /> -e MULTISITE=yes \<br /> -e AUTO_LETS_ENCRYPT=yes \<br /> -e REDIRECT_HTTP_TO_HTTPS=yes \<br /> -e app1.domain.com_REMOTE_PHP=php1 \<br /> -e app1.domain.com_REMOTE_PHP_PATH=/app \<br /> -e app2.domain.com_REMOTE_PHP=php2 \<br /> -e app2.domain.com_REMOTE_PHP_PATH=/app \<br /> bunkerity/bunkerized-nginx</code></pre></div> <p>The <em>/where/are/web/files</em> directory should have a structure like this :</p> <div><pre><code>/where/are/web/files<br />├── app1.domain.com<br />│&nbsp;&nbsp; └── index.php<br />│&nbsp;&nbsp; └── ...<br />└── app2.domain.com<br /> └── index.php<br /> └── ...</code></pre></div> <br /><span style="font-size: large;"><b>Antibot challenge</b></span><br /> <div><pre><code>docker run -p 80:8080 -v /path/to/web/files:/www -e USE_ANTIBOT=captcha bunkerity/bunkerized-nginx</code></pre></div> <p>When <code>USE_ANTIBOT</code> is set to <em>captcha</em>, every users visiting your website must complete a captcha before accessing the pages. Others challenges are also available : <em>cookie</em>, <em>javascript</em> or <em>recaptcha</em> (more info <a href="https://github.com/bunkerity/bunkerized-nginx#antibot" rel="nofollow" target="_blank" title="here">here</a>).</p> <br /><span style="font-size: x-large;"><b>Tutorials and examples</b></span><br /> <p>You will find some docker-compose.yml examples in the <a href="https://github.com/bunkerity/bunkerized-nginx/tree/master/examples" rel="nofollow" target="_blank" title="examples directory">examples directory</a> and tutorials about bunkerized-nginx in our <a href="https://www.bunkerity.com/category/bunkerized-nginx/" rel="nofollow" target="_blank" title="blog">blog</a>.</p> <br /><span style="font-size: x-large;"><b>List of environment variables</b></span><br /> <br /><span style="font-size: large;"><b>nginx</b></span><br /> <br /><b>Misc</b><br /> <p><code>MULTISITE</code><br /> Values : <em>yes</em> | <em>no</em><br /> Default value : <em>no</em><br /> Context : <em>global</em><br /> When set to <em>no</em>, only one server block will be generated. Otherwise one server per host defined in the <code>SERVER_NAME</code> environment variable will be generated.<br /> Any environment variable tagged as <em>multisite</em> context can be used for a specific server block with the following format : <em>host_VARIABLE=value</em>. If the variable is used without the host prefix it will be applied to all the server blocks (but still can be overriden).</p> <p><code>SERVER_NAME</code><br /> Values : <em>&lt;first name&gt; &lt;second name&gt; ...</em><br /> Default value : <em><a href="http://www.bunkerity.com" rel="nofollow" target="_blank" title="www.bunkerity.com">www.bunkerity.com</a></em><br /> Context : <em>global</em><br /> Sets the host names of the webserver separated with spaces. This must match the Host header sent by clients.<br /> Useful when used with <code>MULTISITE=yes</code> and/or <code>AUTO_LETSENCRYPT=yes</code> and/or <code>DISABLE_DEFAULT_SERVER=yes</code>.</p> <p><code>MAX_CLIENT_SIZE</code><br /> Values : <em>0</em> | <em>Xm</em><br /> Default value : <em>10m</em><br /> Context : <em>global</em>, <em>multisite</em><br /> Sets the maximum body size before nginx returns a 413 error code.<br /> Setting to 0 means "infinite" body size.</p> <p><code>ALLOWED_METHODS</code><br /> Values : <em>allowed HTTP methods separated with | char</em><br /> Default value : <em>GET|POST|HEAD</em><br /> Context : <em>global</em>, <em>multisite</em><br /> Only the HTTP methods listed here will be accepted by nginx. If not listed, nginx will close the connection.</p> <p><code>DISABLE_DEFAULT_SERVER</code><br /> Values : <em>yes</em> | <em>no</em><br /> Default value : <em>no</em><br /> Context : <em>global</em>, <em>multisite</em><br /> If set to yes, nginx will only respond to HTTP request when the Host header match a FQDN specified in the <code>SERVER_NAME</code> environment variable.<br /> For example, it will close the connection if a bot access the site with direct ip.</p> <p><code>SERVE_FILES</code><br /> Values : <em>yes</em> | <em>no</em><br /> Default value : <em>yes</em><br /> Context : <em>global</em>, <em>multisite</em><br /> If set to yes, nginx will serve files from /www directory within the container.<br /> A use case to not serving files is when you setup bunkerized-nginx as a reverse proxy via a custom configuration.</p> <p><code>DNS_RESOLVERS</code><br /> Values : <em>&lt;two IP addresses separated with a space&gt;</em><br /> Default value : <em>127.0.0.11 8.8.8.8</em><br /> Context : <em>global</em><br /> The IP addresses of the DNS resolvers to use when performing DNS lookups.</p> <p><code>ROOT_FOLDER</code><br /> Values : *&lt;any valid path to web files&gt;<br /> Default value : <em>/www</em><br /> Context : <em>global</em><br /> The default folder where nginx will search for web files. Don't change it unless you want to make your own image.</p> <p><code>HTTP_PORT</code><br /> Values : <em>&lt;any valid port greater than 1024&gt;</em><br /> Default value : <em>8080</em><br /> Context : <em>global</em><br /> The HTTP port number used by nginx and certbot inside the container.</p> <p><code>HTTPS_PORT</code><br /> Values : <em>&lt;any valid port greater than 1024&gt;</em><br /> Default value : <em>8443</em><br /> Context : <em>global</em><br /> The HTTPS port number used by nginx inside the container.</p> <br /><b>Information leak</b><br /> <p><code>SERVER_TOKENS</code><br /> Values : <em>on</em> | <em>off</em><br /> Default value : <em>off</em><br /> Context : <em>global</em><br /> If set to on, nginx will display server version in Server header and default error pages.</p> <p><code>REMOVE_HEADERS</code><br /> Values : &lt;<em>list of headers separated with space</em>&gt;<br /> Default value : <em>Server X-Powered-By X-AspNet-Version X-AspNetMvc-Version</em><br /> Context : <em>global</em>, <em>multisite</em><br /> List of header to remove when sending responses to clients.</p> <br /><b>Custom error pages</b><br /> <p><code>ERROR_XXX</code><br /> Values : <em>&lt;relative path to the error page&gt;</em><br /> Default value :<br /> Context : <em>global</em>, <em>multisite</em><br /> Use this kind of environment variable to define custom error page depending on the HTTP error code. Replace XXX with HTTP code.<br /> For example : <code>ERROR_404=/404.html</code> means the /404.html page will be displayed when 404 code is generated. The path is relative to the root web folder.</p> <br /><b>HTTP basic authentication</b><br /> <p><code>USE_AUTH_BASIC</code><br /> Values : <em>yes</em> | <em>no</em><br /> Default value : <em>no</em><br /> Context : <em>global</em>, <em>multisite</em><br /> If set to yes, enables HTTP <a href="https://www.kitploit.com/search/label/Basic%20Authentication" target="_blank" title="basic authentication">basic authentication</a> at the location <code>AUTH_BASIC_LOCATION</code> with user <code>AUTH_BASIC_USER</code> and password <code>AUTH_BASIC_PASSWORD</code>.</p> <p><code>AUTH_BASIC_LOCATION</code><br /> Values : <em>sitewide</em> | <em>/somedir</em> | <em>&lt;any valid location&gt;</em><br /> Default value : <em>sitewide</em><br /> Context : <em>global</em>, <em>multisite</em><br /> The location to restrict when <code>USE_AUTH_BASIC</code> is set to <em>yes</em>. If the special value <em>sitewide</em> is used then auth basic will be set at server level outside any location context.</p> <p><code>AUTH_BASIC_USER</code><br /> Values : <em>&lt;any valid username&gt;</em><br /> Default value : <em>changeme</em><br /> Context : <em>global</em>, <em>multisite</em><br /> The username allowed to access <code>AUTH_BASIC_LOCATION</code> when <code>USE_AUTH_BASIC</code> is set to yes.</p> <p><code>AUTH_BASIC_PASSWORD</code><br /> Values : <em>&lt;any valid password&gt;</em><br /> Default value : <em>changeme</em><br /> Context : <em>global</em>, <em>multisite</em><br /> The password of <code>AUTH_BASIC_USER</code> when <code>USE_AUTH_BASIC</code> is set to yes.</p> <p><code>AUTH_BASIC_TEXT</code><br /> Values : <em>&lt;any valid text&gt;</em><br /> Default value : <em>Restricted area</em><br /> Context : <em>global</em>, <em>multisite</em><br /> The text displayed inside the login prompt when <code>USE_AUTH_BASIC</code> is set to yes.</p> <br /><b>Reverse proxy</b><br /> <p><code>USE_REVERSE_PROXY</code><br /> Values : <em>yes</em> | <em>no</em><br /> Default value : <em>no</em><br /> Context : <em>global</em>, <em>multisite</em><br /> Set this environment variable to <em>yes</em> if you want to use bunkerized-nginx as a reverse proxy.</p> <p><code>REVERSE_PROXY_URL</code><br /> Values : &lt;<em>any valid location path</em>&gt;<br /> Default value :<br /> Context : <em>global</em>, <em>multisite</em><br /> Only valid when <code>USE_REVERSE_PROXY</code> is set to <em>yes</em>. Let's you define the location path to match when acting as a reverse proxy.<br /> You can set multiple url/host by adding a suffix number to the variable name like this : <code>REVERSE_PROXY_URL_1</code>, <code>REVERSE_PROXY_URL_2</code>, <code>REVERSE_PROXY_URL_3</code>, ...</p> <p><code>REVERSE_PROXY_HOST</code><br /> Values : &lt;<em>any valid proxy_pass value</em>&gt;<br /> Default value :<br /> Context : <em>global</em>, <em>multisite</em><br /> Only valid when <code>USE_REVERSE_PROXY</code> is set to <em>yes</em>. Let's you define the proxy_pass destination to use when acting as a reverse proxy.<br /> You can set multiple url/host by adding a suffix number to the variable name like this : <code>REVERSE_PROXY_HOST_1</code>, <code>REVERSE_PROXY_HOST_2</code>, <code>REVERSE_PROXY_HOST_3</code>, ...</p> <p><code>PROXY_REAL_IP</code><br /> Values : <em>yes</em> | <em>no</em><br /> Default value : <em>no</em><br /> Context : <em>global</em>, <em>multisite</em><br /> Set this environment variable to <em>yes</em> if you're using bunkerized-nginx behind a reverse proxy. This means you will see the real client address instead of the proxy one inside your logs. Modsecurity, fail2ban and others security tools will also then work correctly.</p> <p><code>PROXY_REAL_IP_FROM</code><br /> Values : <em>&lt;list of trusted IP addresses and/or networks separated with spaces&gt;</em><br /> Default value : <em>192.168.0.0/16 172.16.0.0/12 10.0.0.0/8</em><br /> Context : <em>global</em>, <em>multisite</em><br /> When <code>PROXY_REAL_IP</code> is set to <em>yes</em>, lets you define the trusted IPs/networks allowed to send the correct client address.</p> <p><code>PROXY_REAL_IP_HEADER</code><br /> Values : <em>X-Forwarded-For</em> | <em>X-Real-IP</em> | <em>custom header</em><br /> Default value : <em>X-Forwarded-For</em><br /> Context : <em>global</em>, <em>multisite</em><br /> When <code>PROXY_REAL_IP</code> is set to <em>yes</em>, lets you define the header that contains the real client IP address.</p> <p><code>PROXY_REAL_IP_RECURSIVE</code><br /> Values : <em>on</em> | <em>off</em><br /> Default value : <em>on</em><br /> Context : <em>global</em>, <em>multisite</em><br /> When <code>PROXY_REAL_IP</code> is set to <em>yes</em>, setting this to <em>on</em> avoid spoofing attacks using the header defined in <code>PROXY_REAL_IP_HEADER</code>.</p> <br /><b>Compression</b><br /> <p><code>USE_GZIP</code><br /> Values : <em>yes</em> | <em>no</em><br /> Default value : <em>no</em><br /> Context : <em>global</em>, <em>multisite</em><br /> When set to <em>yes</em>, nginx will use the gzip algorithm to compress responses sent to clients.</p> <p><code>GZIP_COMP_LEVEL</code><br /> Values : &lt;<em>any integer between 1 and 9</em>&gt;<br /> Default value : <em>5</em><br /> Context : <em>global</em>, <em>multisite</em><br /> The gzip compression level to use when <code>USE_GZIP</code> is set to <em>yes</em>.</p> <p><code>GZIP_MIN_LENGTH</code><br /> Values : &lt;<em>any positive integer</em>&gt;<br /> Default value : <em>1000</em><br /> Context : <em>global</em>, <em>multisite</em><br /> The minimum size (in bytes) of a response required to compress when <code>USE_GZIP</code> is set to <em>yes</em>.</p> <p><code>GZIP_TYPES</code><br /> Values : &lt;<em>list of mime types separated with space</em>&gt;<br /> Default value : <em>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</em><br /> Context : <em>global</em>, <em>multisite</em><br /> List of response MIME type required to compress when <code>USE_GZIP</code> is set to <em>yes</em>.</p> <p><code>USE_BROTLI</code><br /> Values : <em>yes</em> | <em>no</em><br /> Default value : <em>no</em><br /> Context : <em>global</em>, <em>multisite</em><br /> When set to <em>yes</em>, nginx will use the brotli algorithm to compress responses sent to clients.</p> <p><code>BROTLI_COMP_LEVEL</code><br /> Values : &lt;<em>any integer between 1 and 9</em>&gt;<br /> Default value : <em>5</em><br /> Context : <em>global</em>, <em>multisite</em><br /> The brotli compression level to use when <code>USE_BROTLI</code> is set to <em>yes</em>.</p> <p><code>BROTLI_MIN_LENGTH</code><br /> Values : &lt;<em>any positive integer</em>&gt;<br /> Default value : <em>1000</em><br /> Context : <em>global</em>, <em>multisite</em><br /> The minimum size (in bytes) of a response required to compress when <code>USE_BROTLI</code> is set to <em>yes</em>.</p> <p><code>BROTLI_TYPES</code><br /> Values : &lt;<em>list of mime types separated with space</em>&gt;<br /> Default value : <em>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</em><br /> Context : <em>global</em>, <em>multisite</em><br /> List of response MIME type required to compress when <code>USE_BROTLI</code> is set to <em>yes</em>.</p> <br /><b>Cache</b><br /> <p><code>USE_CLIENT_CACHE</code><br /> Values : <em>yes</em> | <em>no</em><br /> Default value : <em>no</em><br /> Context : <em>global</em>, <em>multisite</em><br /> When set to <em>yes</em>, clients will be told to cache some files locally.</p> <p><code>CLIENT_CACHE_EXTENSIONS</code><br /> Values : &lt;<em>list of extensions separated with |</em>&gt;<br /> Default value : <em>jpg|jpeg|png|bmp|ico|svg|tif|css|js|otf|ttf|eot|woff|woff2</em><br /> Context : <em>global</em>, <em>multisite</em><br /> List of file extensions that clients should cache when <code>USE_CLIENT_CACHE</code> is set to <em>yes</em>.</p> <p><code>CLIENT_CACHE_CONTROL</code><br /> Values : &lt;<em>Cache-Control header value</em>&gt;<br /> Default value : <em>public, max-age=15552000</em><br /> Context : <em>global</em>, <em>multisite</em><br /> Content of the <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control" rel="nofollow" target="_blank" title="Cache-Control">Cache-Control</a> header to send when <code>USE_CLIENT_CACHE</code> is set to <em>yes</em>.</p> <p><code>CLIENT_CACHE_ETAG</code><br /> Values : <em>on</em> | <em>off</em><br /> Default value : <em>on</em><br /> Context : <em>global</em>, <em>multisite</em><br /> Whether or not nginx will send the <a href="https://en.wikipedia.org/wiki/HTTP_ETag" rel="nofollow" target="_blank" title="ETag">ETag</a> header when <code>USE_CLIENT_CACHE</code> is set to <em>yes</em>.</p> <p><code>USE_OPEN_FILE_CACHE</code><br /> Values : <em>yes</em> | <em>no</em><br /> Default value : <em>no</em><br /> Context : <em>global</em>, <em>multisite</em><br /> When set to <em>yes</em>, nginx will cache open fd, existence of directories, ... See <a href="http://nginx.org/en/docs/http/ngx_http_core_module.html#open_file_cache" rel="nofollow" target="_blank" title="open_file_cache">open_file_cache</a>.</p> <p><code>OPEN_FILE_CACHE</code><br /> Values : &lt;<em>any valid open_file_cache parameters</em>&gt;<br /> Default value : <em>max=1000 inactive=20s</em><br /> Context : <em>global</em>, <em>multisite</em><br /> Parameters to use with open_file_cache when <code>USE_OPEN_FILE_CACHE</code> is set to <em>yes</em>.</p> <p><code>OPEN_FILE_CACHE_ERRORS</code><br /> Values : <em>on</em> | <em>off</em><br /> Default value : <em>on</em><br /> Context : <em>global</em>, <em>multisite</em><br /> Whether or not nginx should cache file lookup errors when <code>USE_OPEN_FILE_CACHE</code> is set to <em>yes</em>.</p> <p><code>OPEN_FILE_CACHE_MIN_USES</code><br /> Values : &lt;*any valid integer *&gt;<br /> Default value : <em>2</em><br /> Context : <em>global</em>, <em>multisite</em><br /> The minimum number of file accesses required to cache the fd when <code>USE_OPEN_FILE_CACHE</code> is set to <em>yes</em>.</p> <p><code>OPEN_FILE_CACHE_VALID</code><br /> Values : &lt;<em>any time value like Xs, Xm, Xh, ...</em>&gt;<br /> Default value : <em>30s</em><br /> Context : <em>global</em>, <em>multisite</em><br /> The time after which cached elements should be validated when <code>USE_OPEN_FILE_CACHE</code> is set to <em>yes</em>.</p> <p><code>USE_PROXY_CACHE</code><br /> Values : <em>yes</em> | <em>no</em><br /> Default value : <em>no</em><br /> Context : <em>global</em>, <em>multisite</em><br /> When set to <em>yes</em>, nginx will cache responses from proxied applications. See <a href="http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_cache" rel="nofollow" target="_blank" title="proxy_cache">proxy_cache</a>.</p> <p><code>PROXY_CACHE_PATH_ZONE_SIZE</code><br /> Values : &lt;<em>any valid size like Xk, Xm, Xg, ...</em>&gt;<br /> Default value : <em>10m</em><br /> Context : <em>global</em>, <em>multisite</em><br /> Maximum size of cached metadata when <code>USE_PROXY_CACHE</code> is set to <em>yes</em>.</p> <p><code>PROXY_CACHE_PATH_PARAMS</code><br /> Values : &lt;<em>any valid parameters to proxy_cache_path directive</em>&gt;<br /> Default value : <em>max_size=100m</em><br /> Context : <em>global</em>, <em>multisite</em><br /> Parameters to use for <a href="http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_cache_path" rel="nofollow" target="_blank" title="proxy_cache_path">proxy_cache_path</a> directive when <code>USE_PROXY_CACHE</code> is set to <em>yes</em>.</p> <p><code>PROXY_CACHE_METHODS</code><br /> Values : &lt;<em>list of HTTP methods separated with space</em>&gt;<br /> Default value : <em>GET HEAD</em><br /> Context : <em>global</em>, <em>multisite</em><br /> The HTTP methods that should trigger a cache operation when <code>USE_PROXY_CACHE</code> is set to <em>yes</em>.</p> <p><code>PROXY_CACHE_MIN_USES</code><br /> Values : &lt;<em>any positive integer</em>&gt;<br /> Default value : <em>2</em><br /> Context : <em>global</em>, <em>multisite</em><br /> The minimum number of requests before the response is cached when <code>USE_PROXY_CACHE</code> is set to <em>yes</em>.</p> <p><code>PROXY_CACHE_KEY</code><br /> Values : &lt;<em>list of variables</em>&gt;<br /> Default value : <em>$scheme$host$request_uri</em><br /> Context : <em>global</em>, <em>multisite</em><br /> The key used to uniquely identify a cached response when <code>USE_PROXY_CACHE</code> is set to <em>yes</em>.</p> <p><code>PROXY_CACHE_VALID</code><br /> Values : &lt;<em>status=time list separated with space</em>&gt;<br /> Default value : <em>200=10m 301=10m 301=1h any=1m</em><br /> Context : <em>global</em>, <em>multisite</em><br /> Define the caching time depending on the HTTP status code (list of status=time separated with space) when <code>USE_PROXY_CACHE</code> is set to <em>yes</em>.</p> <p><code>PROXY_NO_CACHE</code><br /> Values : &lt;<em>list of variables</em>&gt;<br /> Default value : <em>$http_authorization</em><br /> Context : <em>global</em>, <em>multisite</em><br /> Conditions that must be met to disable caching of the response when <code>USE_PROXY_CACHE</code> is set to <em>yes</em>.</p> <p><code>PROXY_CACHE_BYPASS</code><br /> Values : &lt;<em>list of variables</em>&gt; Default value : <em>$http_authorization</em><br /> Context : <em>global</em>, <em>multisite</em> Conditions that must be met to bypass the cache when <code>USE_PROXY_CACHE</code> is set to <em>yes</em>.</p> <br /><span style="font-size: large;"><b>HTTPS</b></span><br /> <br /><b>Let's Encrypt</b><br /> <p><code>AUTO_LETS_ENCRYPT</code><br /> Values : <em>yes</em> | <em>no</em><br /> Default value : <em>no</em><br /> Context : <em>global</em><br /> If set to yes, automatic certificate generation and renewal will be setup through Let's Encrypt. This will enable HTTPS on your website for free.<br /> You will need to redirect the 80 port to 8080 port inside container and also set the <code>SERVER_NAME</code> environment variable.</p> <br /><b>HTTP</b><br /> <p><code>LISTEN_HTTP</code><br /> Values : <em>yes</em> | <em>no</em><br /> Default value : <em>yes</em><br /> Context : <em>global</em>, <em>multisite</em><br /> If set to no, nginx will not in listen on HTTP (port 80).<br /> Useful if you only want HTTPS access to your website.</p> <p><code>REDIRECT_HTTP_TO_HTTPS</code><br /> Values : <em>yes</em> | <em>no</em><br /> Default value : <em>no</em><br /> Context : <em>global</em>, <em>multisite</em><br /> If set to yes, nginx will redirect all HTTP requests to HTTPS.</p> <br /><b>Custom certificate</b><br /> <p><code>USE_CUSTOM_HTTPS</code><br /> Values : <em>yes</em> | <em>no</em><br /> Default value : <em>no</em><br /> Context : <em>global</em><br /> If set to yes, HTTPS will be enabled with certificate/key of your choice.</p> <p><code>CUSTOM_HTTPS_CERT</code><br /> Values : <em>&lt;any valid path inside the container&gt;</em><br /> Default value :<br /> Context : <em>global</em><br /> Full path of the certificate file to use when <code>USE_CUSTOM_HTTPS</code> is set to yes.</p> <p><code>CUSTOM_HTTPS_KEY</code><br /> Values : <em>&lt;any valid path inside the container&gt;</em><br /> Default value :<br /> Context : <em>global</em><br /> Full path of the key file to use when <code>USE_CUSTOM_HTTPS</code> is set to yes.</p> <br /><b>Self-signed certificate</b><br /> <p><code>GENERATE_SELF_SIGNED_SSL</code><br /> Values : <em>yes</em> | <em>no</em><br /> Default value : <em>no</em><br /> Context : <em>global</em><br /> If set to yes, HTTPS will be enabled with a container generated self-signed certificate.</p> <p><code>SELF_SIGNED_SSL_EXPIRY</code><br /> Values : <em>integer</em><br /> Default value : <em>365</em> (1 year)<br /> Context : <em>global</em><br /> Needs <code>GENERATE_SELF_SIGNED_SSL</code> to work. Sets the expiry date for the self generated certificate.</p> <p><code>SELF_SIGNED_SSL_COUNTRY</code><br /> Values : <em>text</em><br /> Default value : <em>Switzerland</em><br /> Context : <em>global</em><br /> Needs <code>GENERATE_SELF_SIGNED_SSL</code> to work. Sets the country for the self generated certificate.</p> <p><code>SELF_SIGNED_SSL_STATE</code><br /> Values : <em>text</em><br /> Default value : <em>Switzerland</em><br /> Context : <em>global</em><br /> Needs <code>GENERATE_SELF_SIGNED_SSL</code> to work. Sets the state for the self generated certificate.</p> <p><code>SELF_SIGNED_SSL_CITY</code><br /> Values : <em>text</em><br /> Default value : <em>Bern</em><br /> Context : <em>global</em><br /> Needs <code>GENERATE_SELF_SIGNED_SSL</code> to work. Sets the city for the self generated certificate.</p> <p><code>SELF_SIGNED_SSL_ORG</code><br /> Values : <em>text</em><br /> Default value : <em>AcmeInc</em><br /> Context : <em>global</em><br /> Needs <code>GENERATE_SELF_SIGNED_SSL</code> to work. Sets the organisation name for the self generated certificate.</p> <p><code>SELF_SIGNED_SSL_OU</code><br /> Values : <em>text</em><br /> Default value : <em>IT</em><br /> Context : <em>global</em><br /> Needs <code>GENERATE_SELF_SIGNED_SSL</code> to work. Sets the organisitional unit for the self generated certificate.</p> <p><code>SELF_SIGNED_SSL_CN</code><br /> Values : <em>text</em><br /> Default value : <em>bunkerity-nginx</em><br /> Context : <em>global</em><br /> Needs <code>GENERATE_SELF_SIGNED_SSL</code> to work. Sets the CN server name for the self generated certificate.</p> <br /><b>Misc</b><br /> <p><code>HTTP2</code><br /> Values : <em>yes</em> | <em>no</em><br /> Default value : <em>yes</em><br /> Context : <em>global</em>, <em>multisite</em><br /> If set to yes, nginx will use HTTP2 protocol when HTTPS is enabled.</p> <p><code>HTTPS_PROTOCOLS</code><br /> Values : <em>TLSv1.2</em> | <em>TLSv1.3</em> | <em>TLSv1.2 TLSv1.3</em><br /> Default value : <em>TLSv1.2 TLSv1.3</em><br /> Context : <em>global</em>, <em>multisite</em><br /> The supported version of TLS. We recommend the default value <em>TLSv1.2 TLSv1.3</em> for compatibility reasons.</p> <br /><span style="font-size: large;"><b>ModSecurity</b></span><br /> <p><code>USE_MODSECURITY</code><br /> Values : <em>yes</em> | <em>no</em><br /> Default value : <em>yes</em><br /> Context : <em>global</em>, <em>multisite</em><br /> If set to yes, the ModSecurity WAF will be enabled.<br /> You can include custom rules by adding .conf files into the /modsec-confs/ directory inside the container (i.e : through a volume).</p> <p><code>USE_MODSECURITY_CRS</code><br /> Values : <em>yes</em> | <em>no</em><br /> Default value : <em>yes</em><br /> Context : <em>global</em>, <em>multisite</em><br /> If set to yes, the <a href="https://coreruleset.org/" rel="nofollow" target="_blank" title="OWASP ModSecurity Core Rule Set">OWASP ModSecurity Core Rule Set</a> will be used. It provides generic rules to detect common web attacks.<br /> You can customize the CRS (i.e. : add WordPress exclusions) by adding custom .conf files into the /modsec-crs-confs/ directory inside the container (i.e : through a volume). Files inside this directory are included before the CRS rules. If you need to tweak (i.e. : SecRuleUpdateTargetById) put .conf files inside the /modsec-confs/ which is included after the CRS rules.</p> <br /><span style="font-size: large;"><b>Security headers</b></span><br /> <p><code>X_FRAME_OPTIONS</code><br /> Values : <em>DENY</em> | <em>SAMEORIGIN</em> | <em>ALLOW-FROM <a href="https://www.website.net" rel="nofollow" target="_blank" title="https://www.website.net">https://www.website.net</a></em> | <em>ALLOWALL</em><br /> Default value : <em>DENY</em><br /> Context : <em>global</em>, <em>multisite</em><br /> Policy to be used when the site is displayed through iframe. Can be used to mitigate <a href="https://www.kitploit.com/search/label/ClickJacking" target="_blank" title="clickjacking">clickjacking</a> attacks. More info <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Frame-Options" rel="nofollow" target="_blank" title="here">here</a>.</p> <p><code>X_XSS_PROTECTION</code><br /> Values : <em>0</em> | <em>1</em> | <em>1; mode=block</em><br /> Default value : <em>1; mode=block</em><br /> Context : <em>global</em>, <em>multisite</em><br /> Policy to be used when XSS is detected by the browser. Only works with Internet Explorer.<br /> More info <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-XSS-Protection" rel="nofollow" target="_blank" title="here">here</a>.</p> <p><code>X_CONTENT_TYPE_OPTIONS</code><br /> Values : <em>nosniff</em><br /> Default value : <em>nosniff</em><br /> Context : <em>global</em>, <em>multisite</em><br /> Tells the browser to be strict about MIME type.<br /> More info <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Content-Type-Options" rel="nofollow" target="_blank" title="here">here</a>.</p> <p><code>REFERRER_POLICY</code><br /> Values : <em>no-referrer</em> | <em>no-referrer-when-downgrade</em> | <em>origin</em> | <em>origin-when-cross-origin</em> | <em>same-origin</em> | <em>strict-origin</em> | <em>strict-origin-when-cross-origin</em> | <em>unsafe-url</em><br /> Default value : <em>no-referrer</em><br /> Context : <em>global</em>, <em>multisite</em><br /> Policy to be used for the Referer header.<br /> More info <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Referrer-Policy" rel="nofollow" target="_blank" title="here">here</a>.</p> <p><code>FEATURE_POLICY</code><br /> Values : <em>&lt;directive&gt; &lt;allow list&gt;</em><br /> Default value : <em>accelerometer 'none'; ambient-light-sensor 'none'; autoplay 'none'; camera 'none'; display-capture 'none'; document-domain 'none'; encrypted-media 'none'; fullscreen 'none'; <a href="https://www.kitploit.com/search/label/Geolocation" target="_blank" title="geolocation">geolocation</a> 'none'; gyroscope 'none'; magnetometer 'none'; microphone 'none'; midi 'none'; payment 'none'; picture-in-picture 'none'; speaker 'none'; sync-xhr 'none'; usb 'none'; vibrate 'none'; vr 'none'</em><br /> Context : <em>global</em>, <em>multisite</em><br /> Tells the browser which features can be used on the website.<br /> More info <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Feature-Policy" rel="nofollow" target="_blank" title="here">here</a>.</p> <p><code>PERMISSIONS_POLICY</code><br /> Values : <em>feature=(allow list)</em><br /> Default value : accelerometer=(), ambient-light-sensor=(), autoplay=(), camera=(), display-capture=(), document-domain=(), encrypted-media=(), fullscreen=(), geolocation=(), gyroscope=(), magnetometer=(), microphone=(), midi=(), payment=(), picture-in-picture=(), speaker=(), sync-xhr=(), usb=(), vibrate=(), vr=()<br /> Context : <em>global</em>, <em>multisite</em><br /> Tells the browser which features can be used on the website.<br /> More info <a href="https://www.w3.org/TR/permissions-policy-1/" rel="nofollow" target="_blank" title="here">here</a>.</p> <p><code>COOKIE_FLAGS</code><br /> Values : <em>* HttpOnly</em> | <em>MyCookie secure SameSite=Lax</em> | <em>...</em><br /> Default value : <em>* HttpOnly SameSite=Lax</em><br /> Context : <em>global</em>, <em>multisite</em><br /> Adds some security to the cookies set by the server.<br /> Accepted value can be found <a href="https://github.com/AirisX/nginx_cookie_flag_module" rel="nofollow" target="_blank" title="here">here</a>.</p> <p><code>COOKIE_AUTO_SECURE_FLAG</code><br /> Values : <em>yes</em> | <em>no</em><br /> Default value : <em>yes</em><br /> Context : <em>global</em>, <em>multisite</em><br /> When set to <em>yes</em>, the <em>secure</em> will be automatically added to cookies when using HTTPS.</p> <p><code>STRICT_TRANSPORT_POLICY</code><br /> Values : <em>max-age=expireTime [; includeSubDomains] [; preload]</em><br /> Default value : <em>max-age=31536000</em><br /> Context : <em>global</em>, <em>multisite</em><br /> Tells the browser to use exclusively HTTPS instead of HTTP when communicating with the server.<br /> More info <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Strict-Transport-Security" rel="nofollow" target="_blank" title="here">here</a>.</p> <p><code>CONTENT_SECURITY_POLICY</code><br /> Values : <em>&lt;directive 1&gt;; &lt;directive 2&gt;; ...</em><br /> Default value : <em>default-src 'self'; frame-ancestors 'self'; form-action 'self'; block-all-mixed-content; sandbox allow-forms allow-same-origin allow-scripts; reflected-xss block; base-uri 'self'; referrer no-referrer</em><br /> Context : <em>global</em>, <em>multisite</em><br /> Policy to be used when loading resources (scripts, forms, frames, ...).<br /> More info <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy" rel="nofollow" target="_blank" title="here">here</a>.</p> <br /><span style="font-size: large;"><b>Blocking</b></span><br /> <br /><b>Antibot</b><br /> <p><code>USE_ANTIBOT</code><br /> Values : <em>no</em> | <em>cookie</em> | <em>javascript</em> | <em>captcha</em> | <em>recaptcha</em><br /> Default value : <em>no</em><br /> Context : <em>global</em>, <em>multisite</em><br /> If set to another allowed value than <em>no</em>, users must complete a "challenge" before accessing the pages on your website :</p> <ul> <li><em>cookie</em> : asks the users to set a cookie</li> <li><em>javascript</em> : users must execute a javascript code</li> <li><em>captcha</em> : a text captcha must be resolved by the users</li> <li><em>recaptcha</em> : use <a href="https://developers.google.com/recaptcha/intro" rel="nofollow" target="_blank" title="Google reCAPTCHA v3">Google reCAPTCHA v3</a> score to allow/deny users</li> </ul> <p><code>ANTIBOT_URI</code><br /> Values : <em>&lt;any valid uri&gt;</em><br /> Default value : <em>/challenge</em><br /> Context : <em>global</em>, <em>multisite</em><br /> A valid and unused URI to redirect users when <code>USE_ANTIBOT</code> is used. Be sure that it doesn't exist on your website.</p> <p><code>ANTIBOT_SESSION_SECRET</code><br /> Values : <em>random</em> | <em>&lt;32 chars of your choice&gt;</em><br /> Default value : <em>random</em><br /> Context : <em>global</em>, <em>multisite</em><br /> A secret used to generate sessions when <code>USE_ANTIBOT</code> is set. Using the special <em>random</em> value will generate a random one. Be sure to use the same value when you are in a multi-server environment (so sessions are valid in all the servers).</p> <p><code>ANTIBOT_RECAPTCHA_SCORE</code><br /> Values : <em>&lt;0.0 to 1.0&gt;</em><br /> Default value : <em>0.7</em><br /> Context : <em>global</em>, <em>multisite</em><br /> The minimum score required when <code>USE_ANTIBOT</code> is set to <em>recaptcha</em>.</p> <p><code>ANTIBOT_RECAPTCHA_SITEKEY</code><br /> Values : <em>&lt;public key given by Google&gt;</em><br /> Default value :<br /> Context : <em>global</em><br /> The sitekey given by Google when <code>USE_ANTIBOT</code> is set to <em>recaptcha</em>.</p> <p><code>ANTIBOT_RECAPTCHA_SECRET</code><br /> Values : <em>&lt;private key given by Google&gt;</em><br /> Default value :<br /> Context : <em>global</em><br /> The secret given by Google when <code>USE_ANTIBOT</code> is set to <em>recaptcha</em>.</p> <br /><b>External blacklists</b><br /> <p><code>BLOCK_USER_AGENT</code><br /> Values : <em>yes</em> | <em>no</em><br /> Default value : <em>yes</em> Context : <em>global</em>, <em>multisite</em><br /> If set to yes, block clients with "bad" user agent.<br /> Blacklist can be found <a href="https://raw.githubusercontent.com/mitchellkrogza/nginx-ultimate-bad-bot-blocker/master/_generator_lists/bad-user-agents.list" rel="nofollow" target="_blank" title="here">here</a>.</p> <p><code>BLOCK_TOR_EXIT_NODE</code><br /> Values : <em>yes</em> | <em>no</em><br /> Default value : <em>yes</em><br /> Context : <em>global</em>, <em>multisite</em><br /> Is set to yes, will block known TOR exit nodes.<br /> Blacklist can be found <a href="https://iplists.firehol.org/?ipset=tor_exits" rel="nofollow" target="_blank" title="here">here</a>.</p> <p><code>BLOCK_PROXIES</code><br /> Values : <em>yes</em> | <em>no</em><br /> Default value : <em>yes</em><br /> Context : <em>global</em>, <em>multisite</em><br /> Is set to yes, will block known proxies.<br /> Blacklist can be found <a href="https://iplists.firehol.org/?ipset=firehol_proxies" rel="nofollow" target="_blank" title="here">here</a>.</p> <p><code>BLOCK_ABUSERS</code><br /> Values : <em>yes</em> | <em>no</em><br /> Default value : <em>yes</em><br /> Context : <em>global</em>, <em>multisite</em><br /> Is set to yes, will block known abusers.<br /> Blacklist can be found <a href="https://iplists.firehol.org/?ipset=firehol_abusers_30d" rel="nofollow" target="_blank" title="here">here</a>.</p> <br /><b>DNSBL</b><br /> <p><code>USE_DNSBL</code><br /> Values : <em>yes</em> | <em>no</em><br /> Default value : <em>yes</em><br /> Context : <em>global</em>, <em>multisite</em><br /> If set to <em>yes</em>, DNSBL checks will be performed to the servers specified in the <code>DNSBL_LIST</code> environment variable.</p> <p><code>DNSBL_LIST</code><br /> Values : <em>&lt;list of DNS zones separated with spaces&gt;</em><br /> Default value : <em>bl.blocklist.de problems.dnsbl.sorbs.net sbl.spamhaus.org xbl.spamhaus.org</em><br /> Context : <em>global</em><br /> The list of DNSBL zones to query when <code>USE_DNSBL</code> is set to <em>yes</em>.</p> <br /><b>CrowdSec</b><br /> <p><code>USE_CROWDSEC</code><br /> Values : <em>yes</em> | <em>no</em><br /> Default value : <em>no</em><br /> Context : <em>global</em>, <em>multisite</em><br /> If set to <em>yes</em>, <a href="https://github.com/crowdsecurity/crowdsec" rel="nofollow" target="_blank" title="CrowdSec">CrowdSec</a> will be enabled with the <a href="https://hub.crowdsec.net/author/crowdsecurity/collections/nginx" rel="nofollow" target="_blank" title="nginx collection">nginx collection</a>. API pulls will be done automaticaly.</p> <br /><b>Custom whitelisting</b><br /> <p><code>USE_WHITELIST_IP</code><br /> Values : <em>yes</em> | <em>no</em><br /> Default value : <em>yes</em><br /> Context : <em>global</em>, <em>multisite</em><br /> If set to <em>yes</em>, lets you define custom IP addresses to be whitelisted through the <code>WHITELIST_IP_LIST</code> environment variable.</p> <p><code>WHITELIST_IP_LIST</code><br /> Values : <em>&lt;list of IP addresses separated with spaces&gt;</em><br /> Default value : <em>23.21.227.69 40.88.21.235 50.16.241.113 50.16.241.114 50.16.241.117 50.16.247.234 52.204.97.54 52.5.190.19 54.197.234.188 54.208.100.253 54.208.102.37 107.21.1.8</em><br /> Context : <em>global</em><br /> The list of IP addresses to whitelist when <code>USE_WHITELIST_IP</code> is set to <em>yes</em>. The default list contains IP addresses of the <a href="https://help.duckduckgo.com/duckduckgo-help-pages/results/duckduckbot/" rel="nofollow" target="_blank" title="DuckDuckGo crawler">DuckDuckGo crawler</a>.</p> <p><code>USE_WHITELIST_REVERSE</code><br /> Values : <em>yes</em> | <em>no</em><br /> Default value : <em>yes</em><br /> Context : <em>global</em>, <em>multisite</em><br /> If set to <em>yes</em>, lets you define custom reverse DNS suffixes to be whitelisted through the <code>WHITELIST_REVERSE_LIST</code> environment variable.</p> <p><code>WHITELIST_REVERSE_LIST</code><br /> Values : <em>&lt;list of reverse DNS suffixes separated with spaces&gt;</em><br /> Default value : <em>.googlebot.com .google.com .search.msn.com .crawl.yahoot.net .crawl.baidu.jp .crawl.baidu.com .yandex.com .yandex.ru .yandex.net</em><br /> Context : <em>global</em><br /> The list of reverse DNS suffixes to whitelist when <code>USE_WHITELIST_REVERSE</code> is set to <em>yes</em>. The default list contains suffixes of major search engines.</p> <br /><b>Custom blacklisting</b><br /> <p><code>USE_BLACKLIST_IP</code><br /> Values : <em>yes</em> | <em>no</em><br /> Default value : <em>yes</em><br /> Context : <em>global</em>, <em>multisite</em><br /> If set to <em>yes</em>, lets you define custom IP addresses to be blacklisted through the <code>BLACKLIST_IP_LIST</code> environment variable.</p> <p><code>BLACKLIST_IP_LIST</code><br /> Values : <em>&lt;list of IP addresses separated with spaces&gt;</em><br /> Default value :<br /> Context : <em>global</em><br /> The list of IP addresses to blacklist when <code>USE_BLACKLIST_IP</code> is set to <em>yes</em>.</p> <p><code>USE_BLACKLIST_REVERSE</code><br /> Values : <em>yes</em> | <em>no</em><br /> Default value : <em>yes</em><br /> Context : <em>global</em>, <em>multisite</em><br /> If set to <em>yes</em>, lets you define custom reverse DNS suffixes to be blacklisted through the <code>BLACKLIST_REVERSE_LIST</code> environment variable.</p> <p><code>BLACKLIST_REVERSE_LIST</code><br /> Values : <em>&lt;list of reverse DNS suffixes separated with spaces&gt;</em><br /> Default value : <em>.shodan.io</em><br /> Context : <em>global</em><br /> The list of reverse DNS suffixes to blacklist when <code>USE_BLACKLIST_REVERSE</code> is set to <em>yes</em>.</p> <br /><b>Requests limiting</b><br /> <p><code>USE_LIMIT_REQ</code><br /> Values : <em>yes</em> | <em>no</em><br /> Default value : <em>yes</em><br /> Context : <em>global</em>, <em>multisite</em><br /> If set to yes, the amount of HTTP requests made by a user will be limited during a period of time.<br /> More info rate limiting <a href="https://www.nginx.com/blog/rate-limiting-nginx/" rel="nofollow" target="_blank" title="here">here</a>.</p> <p><code>LIMIT_REQ_RATE</code><br /> Values : <em>Xr/s</em> | <em>Xr/m</em><br /> Default value : <em>20r/s</em><br /> Context : <em>global</em>, <em>multisite</em><br /> The rate limit to apply when <code>USE_LIMIT_REQ</code> is set to <em>yes</em>. Default is 10 requests per second.</p> <p><code>LIMIT_REQ_BURST</code><br /> Values : <em>&lt;any valid integer&gt;</em><br /> Default value : <em>40</em><br /> Context : <em>global</em>, <em>multisite</em><br /> The number of of requests to put in queue before rejecting requests.</p> <p><code>LIMIT_REQ_CACHE</code><br /> Values : <em>Xm</em> | <em>Xk</em><br /> Default value : <em>10m</em><br /> Context : <em>global</em><br /> The size of the cache to store information about request limiting.</p> <br /><b>Countries</b><br /> <p><code>BLACKLIST_COUNTRY</code><br /> Values : <em>&lt;country code 1&gt; &lt;country code 2&gt; ...</em><br /> Default value :<br /> Context : <em>global</em>, <em>multisite</em><br /> Block some countries from accessing your website. Use 2 letters country code separated with space.</p> <p><code>WHITELIST_COUNTRY</code><br /> Values : <em>&lt;country code 1&gt; &lt;country code 2&gt; ...</em><br /> Default value :<br /> Context : <em>global</em>, <em>multisite</em><br /> Only allow specific countries accessing your website. Use 2 letters country code separated with space.</p> <br /><span style="font-size: large;"><b>PHP</b></span><br /> <p><code>REMOTE_PHP</code><br /> Values : <em>&lt;any valid IP/hostname&gt;</em><br /> Default value :<br /> Context : <em>global</em>, <em>multisite</em><br /> Set the IP/hostname address of a remote PHP-FPM to execute .php files. See <code>USE_PHP</code> if you want to run a PHP-FPM instance on the same container as bunkerized-nginx.</p> <p><code>REMOTE_PHP_PATH</code><br /> Values : <em>&lt;any valid absolute path&gt;</em><br /> Default value : <em>/app</em><br /> Context : <em>global</em>, <em>multisite</em><br /> The path where the PHP files are located inside the server specified in <code>REMOTE_PHP</code>.</p> <br /><span style="font-size: large;"><b>Fail2ban</b></span><br /> <p><code>USE_FAIL2BAN</code><br /> Values : <em>yes</em> | <em>no</em><br /> Default value : <em>yes</em><br /> Context : <em>global</em>, <em>multisite</em><br /> If set to yes, fail2ban will be used to block users getting too much "strange" HTTP codes in a period of time.<br /> Instead of using iptables which is not possible inside a container, fail2ban will dynamically update nginx to ban/unban IP addresses.<br /> If a number (<code>FAIL2BAN_MAXRETRY</code>) of "strange" HTTP codes (<code>FAIL2BAN_STATUS_CODES</code>) is found between a time interval (<code>FAIL2BAN_FINDTIME</code>) then the originating IP address will be ban for a specific period of time (<code>FAIL2BAN_BANTIME</code>).</p> <p><code>FAIL2BAN_STATUS_CODES</code><br /> Values : <em>&lt;HTTP status codes separated with | char&gt;</em><br /> Default value : <em>400|401|403|404|405|444</em><br /> Context : <em>global</em><br /> List of "strange" error codes that fail2ban will search for.</p> <p><code>FAIL2BAN_BANTIME</code><br /> Values : <em></em><br /> Default value : <em>3600</em><br /> Context : <em>global</em><br /> The duration time, in seconds, of a ban.</p> <p><code>FAIL2BAN_FINDTIME</code><br /> Values : <em></em><br /> Default : value : <em>60</em><br /> Context : <em>global</em><br /> The time interval, in seconds, to search for "strange" HTTP status codes.</p> <p><code>FAIL2BAN_MAXRETRY</code><br /> Values : <em>&lt;any positive integer&gt;</em><br /> Default : value : <em>15</em><br /> Context : <em>global</em><br /> The number of "strange" HTTP status codes to find between the time interval.</p> <br /><span style="font-size: large;"><b>ClamAV</b></span><br /> <p><code>USE_CLAMAV_UPLOAD</code><br /> Values : <em>yes</em> | <em>no</em><br /> Default value : <em>yes</em><br /> Context : <em>global</em>, <em>multisite</em><br /> If set to yes, ClamAV will scan every file uploads and block the upload if the file is detected.</p> <p><code>USE_CLAMAV_SCAN</code><br /> Values : <em>yes</em> | <em>no</em><br /> Default value : <em>yes</em><br /> Context : <em>global</em><br /> If set to yes, ClamAV will scan all the files inside the container every day.</p> <p><code>CLAMAV_SCAN_REMOVE</code><br /> Values : <em>yes</em> | <em>no</em><br /> Default value : <em>yes</em><br /> Context : <em>global</em><br /> If set to yes, ClamAV will automatically remove the detected files.</p> <br /><span style="font-size: large;"><b>Misc</b></span><br /> <p><code>ADDITIONAL_MODULES</code><br /> Values : <em>&lt;list of packages separated with space&gt;</em><br /> Default value :<br /> Context : <em>global</em><br /> You can specify additional modules to install. All <a href="https://pkgs.alpinelinux.org/packages" rel="nofollow" target="_blank" title="alpine packages">alpine packages</a> are valid.</p> <p><code>LOGROTATE_MINSIZE</code><br /> Values : <em>x</em> | <em>xk</em> | <em>xM</em> | <em>xG</em><br /> Default value : 10M<br /> Context : <em>global</em><br /> The minimum size of a log file before being rotated (no letter = bytes, k = kilobytes, M = megabytes, G = gigabytes).</p> <p><code>LOGROTATE_MAXAGE</code><br /> Values : <em>&lt;any integer&gt;</em><br /> Default value : 7<br /> Context : <em>global</em><br /> The number of days before rotated files are deleted.</p> <br /><span style="font-size: x-large;"><b>Include custom configurations</b></span><br /> <p>Custom configurations files (ending with .conf suffix) can be added in some directory inside the container :</p> <ul> <li>/http-confs : http context</li> <li>/server-confs : server context</li> </ul> <p>You just need to use a volume like this :</p> <div><pre><code>docker run ... -v /path/to/http/confs:/http-confs:ro ... -v /path/to/server/confs:/server-confs:ro ... bunkerity/bunkerized-nginx</code></pre></div> <p>When <code>MULTISITE</code> is set to <em>yes</em>, .conf files inside the /server-confs directory are loaded by all the server blocks. You can also set custom configuration for a specific server block by adding files in a subdirectory named as the host defined in the <code>SERVER_NAME</code> environment variable. Here is an example :</p> <div><pre><code>docker run ... -v /path/to/server/confs:/server-confs:ro ... -e MULTISITE=yes -e "SERVER_NAME=app1.domain.com app2.domain.com" ... bunkerity/bunkerized-nginx</code></pre></div> <p>The <em>/path/to/server/confs</em> directory should have a structure like this :</p> <pre><code>/path/to/server/confs<br />├── app1.domain.com<br />│&nbsp;&nbsp; └── custom.conf<br />│&nbsp;&nbsp; └── ...<br />└── app2.domain.com<br /> └── custom.conf<br /> └── ...<br /></code></pre> <br /><span style="font-size: x-large;"><b>Cache data</b></span><br /> <p>You can store cached data (blacklists, geoip DB, ...) to avoid downloading them again after a container deletion by mounting a volume on the /cache directory :</p> <div><pre><code>docker run ... -v /path/to/cache:/cache ... bunkerity/bunkerized-nginx</code></pre></div> <br /><br /><div style="text-align: center;"><b><span style="font-size: x-large;"><a class="kiploit-download" href="https://github.com/bunkerity/bunkerized-nginx" rel="nofollow" target="_blank" title="Download Bunkerized-Nginx">Download Bunkerized-Nginx</a></span></b></div>Zion3R[email protected]

文章来源: http://www.blogger.com/feeds/8317222231133660547/posts/default/1072137038089131435
如有侵权请联系:admin#unsafe.sh