From 3ce477d35095d883047daa79bd6d722eddd3d00a Mon Sep 17 00:00:00 2001 From: kroegerama <1519044+kroegerama@users.noreply.github.com> Date: Sun, 19 May 2024 15:53:02 +0200 Subject: [PATCH 1/2] add include for `root_top.conf` in the nginx.conf Allow custom configuration of the root config in the top of the file. This can be used to load modules, which is not possible at the end of the config file. There is already a `http_top.conf`, so `root_top.conf` is a logical addition. --- docker/rootfs/etc/nginx/nginx.conf | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docker/rootfs/etc/nginx/nginx.conf b/docker/rootfs/etc/nginx/nginx.conf index 82618337..00743703 100644 --- a/docker/rootfs/etc/nginx/nginx.conf +++ b/docker/rootfs/etc/nginx/nginx.conf @@ -14,6 +14,9 @@ error_log /data/logs/fallback_error.log warn; # Includes files with directives to load dynamic modules. include /etc/nginx/modules/*.conf; +# Custom +include /data/nginx/custom/root_top[.]conf; + events { include /data/nginx/custom/events[.]conf; } From ef23e796ec1c8f161020ebac5a607194fd7f5cac Mon Sep 17 00:00:00 2001 From: kroegerama <1519044+kroegerama@users.noreply.github.com> Date: Mon, 20 May 2024 10:35:36 +0200 Subject: [PATCH 2/2] update advanced config documentation describe the `root_top.conf` file and add a snippet for enabling the geoip2 module --- docs/src/advanced-config/index.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/docs/src/advanced-config/index.md b/docs/src/advanced-config/index.md index 7d32e96a..efeaefec 100644 --- a/docs/src/advanced-config/index.md +++ b/docs/src/advanced-config/index.md @@ -173,6 +173,7 @@ NPM has the ability to include different custom configuration snippets in differ You can add your custom configuration snippet files at `/data/nginx/custom` as follow: + - `/data/nginx/custom/root_top.conf`: Included at the top of nginx.conf - `/data/nginx/custom/root.conf`: Included at the very end of nginx.conf - `/data/nginx/custom/http_top.conf`: Included at the top of the main http block - `/data/nginx/custom/http.conf`: Included at the end of the main http block @@ -212,3 +213,12 @@ You can customise the logrotate configuration through a mount (if your custom co ``` For reference, the default configuration can be found [here](https://github.com/NginxProxyManager/nginx-proxy-manager/blob/develop/docker/rootfs/etc/logrotate.d/nginx-proxy-manager). + +## Enabling the geoip2 module + +To enable the geoip2 module, you can create the custom configuration file `/data/nginx/custom/root_top.conf` and include the following snippet: + +``` +load_module /usr/lib/nginx/modules/ngx_http_geoip2_module.so; +load_module /usr/lib/nginx/modules/ngx_stream_geoip2_module.so; +```