[PR #1416] Add support for custom Nginx maintenance templates (NGINX_UI_NGINX_MAINTENANCE_TEMPLATE / Settings > Nginx) #8419

Open
opened 2026-03-12 23:54:24 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/0xJacky/nginx-ui/pull/1416
Author: @enwikuna
Created: 10/30/2025
Status: 🔄 Open

Base: devHead: dev


📝 Commits (8)

  • d64ee85 Add MaintenanceTemplate field to Nginx settings
  • 46b1fc6 Add optional maintenance_template to NginxSettings
  • 8a9a226 Implement custom maintenance template handling
  • 4f15a2b Add maintenance template path input to Nginx settings
  • 322b94f Update maintenance template input in NginxSettings
  • 38d9a8e Refactor maintenance template file handling
  • 0b4659f Add filepath import to maintenance.go
  • 098c219 Update placeholder for maintenance template input

📊 Changes

4 files changed (+26 additions, -1 deletions)

View changed files

📝 api/pages/maintenance.go (+16 -1)
📝 app/src/api/settings.ts (+1 -0)
📝 app/src/views/preference/tabs/NginxSettings.vue (+8 -0)
📝 settings/nginx.go (+1 -0)

📄 Description

  • Add/use environment variable NGINX_UI_NGINX_MAINTENANCE_TEMPLATE to point the app to a custom maintenance HTML template used when maintenance mode is enabled.
  • Allow the maintenance template path to be configured from the web UI as well: Settings > Nginx.
  • If a custom path is provided (env var or UI), the app will load that file from inside the container. If not provided, the built-in default template is used.
  • Document how to provide custom templates by mounting a host directory into the container:
    • Example mount: ./nginx:/etc/nginx
    • Create a maintenance folder inside that mount: ./nginx/maintenance
    • Put your template file there, e.g. ./nginx/maintenance/maintenance.html
    • Set the template path to the absolute path inside the container:
      NGINX_UI_NGINX_MAINTENANCE_TEMPLATE=/etc/nginx/maintenance/maintenance.html
  • Notes:
    • The path must be the absolute path inside the container and the file must be readable by the nginx process (e.g., mode 644).
    • After changing the env var or updating templates (or changing the setting in Settings > Nginx), restart the container or reload nginx for changes to take effect.
    • You can store multiple templates under ./nginx/maintenance and switch between them by updating the env var or the UI setting.
  • Include example docker-compose snippet in docs:
    volumes:
    • ./nginx:/etc/nginx
      environment:
    • NGINX_UI_NGINX_MAINTENANCE_TEMPLATE=/etc/nginx/maintenance/maintenance.html

This commit adds configuration surface and documentation for using custom maintenance templates via environment variable or the UI.

image image
services:
  nginx-ui:
    image: nginx-ui-fixed:local
    container_name: nginx-ui
    restart: always
    stdin_open: true
    tty: true
    environment:
      - TZ=Europe/Berlin
      - GIN_MODE=release
      - NGINX_UI_NGINX_MAINTENANCE_TEMPLATE=enwikuna-maintenance.html

Kindly ask you to test and merge our changes into production line.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/0xJacky/nginx-ui/pull/1416 **Author:** [@enwikuna](https://github.com/enwikuna) **Created:** 10/30/2025 **Status:** 🔄 Open **Base:** `dev` ← **Head:** `dev` --- ### 📝 Commits (8) - [`d64ee85`](https://github.com/0xJacky/nginx-ui/commit/d64ee851df2f583e0ec2993028c3d1a4e3cb756e) Add MaintenanceTemplate field to Nginx settings - [`46b1fc6`](https://github.com/0xJacky/nginx-ui/commit/46b1fc6ae0bcd214829c62151f59fae494a8921e) Add optional maintenance_template to NginxSettings - [`8a9a226`](https://github.com/0xJacky/nginx-ui/commit/8a9a226557f52f24e99d51d1c286f0ee3e08fb97) Implement custom maintenance template handling - [`4f15a2b`](https://github.com/0xJacky/nginx-ui/commit/4f15a2be3c7a38dc0480511a13bed3d7997051d4) Add maintenance template path input to Nginx settings - [`322b94f`](https://github.com/0xJacky/nginx-ui/commit/322b94f8c1c847c7eca912ef4c8dd7fed950cde7) Update maintenance template input in NginxSettings - [`38d9a8e`](https://github.com/0xJacky/nginx-ui/commit/38d9a8e4c730aef654ba660e81b0d4ee129970a9) Refactor maintenance template file handling - [`0b4659f`](https://github.com/0xJacky/nginx-ui/commit/0b4659f3f2b21539afc2ee086ac4b2cb0bc3548e) Add filepath import to maintenance.go - [`098c219`](https://github.com/0xJacky/nginx-ui/commit/098c21971c703297f45b74f3259f4bb25cd01e5d) Update placeholder for maintenance template input ### 📊 Changes **4 files changed** (+26 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `api/pages/maintenance.go` (+16 -1) 📝 `app/src/api/settings.ts` (+1 -0) 📝 `app/src/views/preference/tabs/NginxSettings.vue` (+8 -0) 📝 `settings/nginx.go` (+1 -0) </details> ### 📄 Description - Add/use environment variable NGINX_UI_NGINX_MAINTENANCE_TEMPLATE to point the app to a custom maintenance HTML template used when maintenance mode is enabled. - Allow the maintenance template path to be configured from the web UI as well: Settings > Nginx. - If a custom path is provided (env var or UI), the app will load that file from inside the container. If not provided, the built-in default template is used. - Document how to provide custom templates by mounting a host directory into the container: - Example mount: ./nginx:/etc/nginx - Create a maintenance folder inside that mount: ./nginx/maintenance - Put your template file there, e.g. ./nginx/maintenance/maintenance.html - Set the template path to the absolute path inside the container: NGINX_UI_NGINX_MAINTENANCE_TEMPLATE=/etc/nginx/maintenance/maintenance.html - Notes: - The path must be the absolute path inside the container and the file must be readable by the nginx process (e.g., mode 644). - After changing the env var or updating templates (or changing the setting in Settings > Nginx), restart the container or reload nginx for changes to take effect. - You can store multiple templates under ./nginx/maintenance and switch between them by updating the env var or the UI setting. - Include example docker-compose snippet in docs: volumes: - ./nginx:/etc/nginx environment: - NGINX_UI_NGINX_MAINTENANCE_TEMPLATE=/etc/nginx/maintenance/maintenance.html This commit adds configuration surface and documentation for using custom maintenance templates via environment variable or the UI. <img width="913" height="280" alt="image" src="https://github.com/user-attachments/assets/130349d9-a03c-4f2d-85b3-7621a940f617" /> <img width="1339" height="630" alt="image" src="https://github.com/user-attachments/assets/81a42b3b-cd68-4bb6-ba79-85d75eacc993" /> ``` services: nginx-ui: image: nginx-ui-fixed:local container_name: nginx-ui restart: always stdin_open: true tty: true environment: - TZ=Europe/Berlin - GIN_MODE=release - NGINX_UI_NGINX_MAINTENANCE_TEMPLATE=enwikuna-maintenance.html ``` Kindly ask you to test and merge our changes into production line. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/nginx-ui#8419
No description provided.