Nginx Proxy Guard

Features

Settings and maintenance

The Settings menu collects values that apply to all of nginx and NPG's own operating settings. This page lays out the Settings menu and covers what other pages do not: global settings, error pages, maintenance (log retention), system logs, backup and restore, and raw log files.

The Settings menu

The settings tabs fall into four groups. A tab is shown only to roles with the matching permission area (mostly Settings; Backups for backups, Users for users and SSO, Roles for roles).

GroupTabCovered in
GeneralGlobal Settingsnginx-wide values. This page
SSL / ACMECertificate issuance settings. SSL certificates
Error PagesReplacing the 403, 502, 503 and 504 pages. This page
SecurityCAPTCHAThe challenge page. Geo and cloud blocking
GeoIPThe MaxMind database. Geo and cloud blocking
Bot FilterBot lists. Bot filter
WAF Auto-BanAutomatic bans and Global Trusted IPs. Automatic bans, Trusted IPs and exceptions
Filter SubscriptionsBlocklist subscriptions
Trusted ProxiesWhich proxies the real client IP is read from. Running behind Cloudflare
Domain entries (DDNS)Domain entries in access lists. Access lists and basic auth
AccessUsers, Roles, SSOUsers, roles and SSO
OperationsMaintenanceLog retention. This page
BackupsBackup and restore. This page
System LogsContainer log collection. This page
Cloudflare TunnelPublishing through Cloudflare Tunnel
NotificationsNotifications

Global Settings

Settings → Global Settings sets values for all of nginx. After a change, Save Changes reloads nginx automatically. Apply recommended fills in nginx's recommended tuning values (worker_connections 8192, keepalive 30s/1000 requests and so on) at once, and Reset to Defaults puts every global setting back to its default.

Settings → Global Settings with the Worker, HTTP, Performance and other tabs
Settings → Global Settings with the Worker, HTTP, Performance and other tabs
TabMain fields
WorkerWorker processes and connections, Worker Shutdown Timeout (s)
HTTPKeepalive, Max Body Size (default 100m), sendfile, Server Tokens (off by default)
PerformanceProxy buffers, proxy buffering and request buffering, open file cache
CompressionGzip Compression (on by default), Brotli Compression (off by default), levels and types
SSL/TLSSSL Protocols, ciphers, session cache, OCSP stapling
TimeoutsClient timeouts, Proxy Connect / Send / Read Timeout (s) (60 seconds by default)
AdvancedSee below

Fields on the Advanced tab:

FieldDescription
Direct IP Access HandlingHow requests to the server's bare IP address are handled: Show Nginx Proxy Guard Welcome Page, Return 403 Forbidden or Close Connection (444).
DDoS Protection (Global)Per-IP Connection Limit, Request Rate Limit and Bandwidth Limit across all hosts. See Security headers and rate limits.
IPv6 SupportTurns IPv6 listen directives on or off. Turn it off if the server has no IPv6.
Error Log LevelHow much nginx writes to its error log
Also print access log to docker logsWrites every request line to the npg-proxy container output as well. The record the log screens use is kept regardless.
Strip query string from access logLogs only the path and drops the query string such as ?apiKey=…, so keys and tokens passed in the query do not end up in log files.
Custom HTTP Config, Custom Stream ConfigConfiguration written directly into nginx's http and stream blocks
Instance NameA name shown at the top of every page and in the browser tab (up to 32 characters), to tell several NPG installs apart. Empty shows none.
Public Error Page LanguageDefault language of public error pages such as the 403 block page, and of the CAPTCHA page. Auto follows the visitor's browser (English unless it is Korean); ko and en force one language. A visitor's click on the page's language button takes precedence.

Max Body Size and proxy buffering can be overridden per host on the proxy host's Performance tab; empty uses the global value. For large uploads see Large uploads, WebSockets and timeouts.

Error Pages

Settings → Error Pages replaces the pages NPG shows itself, the block page (403) and the backend error pages (502, 503, 504), with your own HTML. They apply to every proxy host and to visits for domains NPG does not know.

Settings → Error Pages with the built-in and custom page per status code
Settings → Error Pages with the built-in and custom page per status code
  1. Choose the status code to replace.
  2. Enter the HTML. Start from a template begins from the built-in page.
  3. Check it with Preview and click Save. It applies immediately.
  4. To go back, click Go back to the built-in page.

Error pages are shown on each site's own address, so for security scripts do not run on them. Styles, images and fonts work. A page can be up to 256 KB.

Maintenance (log retention)

Log Retention Settings in Settings → Maintenance sets how long each log type is kept. Logs older than that are deleted automatically.

PresetAccess LogsWAF EventsError LogsSystem LogsAdmin Audit
Default1095 days90 days30 days30 days1095 days
Extended365 days180 days90 days90 days1825 days
Minimal30 days30 days7 days7 days365 days

Dashboard Stats Retention under Other Data Retention (90 days by default) is how long the data behind the dashboard charts and summary statistics is kept.

Raw log copies in old compressed logs deletes the raw copies of access and error log lines kept in compressed logs older than two days, to win back database disk space. The values used for analysis and the raw text of WAF events are kept. This cannot be undone, so read the confirmation dialog when you start it.

System Logs

With Enable System Log Collection on in Settings → System Logs, NPG collects the logs of its Docker containers and shows them in Logs → System Logs. Container Log Levels sets the level collected per container, and Exclude Patterns drops matching lines.

Raw log files

nginx also writes the access log to a file (access_raw.log), which NPG reads into the database. Rotation and retention of these files are managed in Logs → Raw Files.

Logs → Raw Files with rotation settings and the file list
Logs → Raw Files with rotation settings and the file list
FieldDescription
Max File Size (MB)Checked every hour; the current file is rotated when it is larger. Files are also rotated every day at midnight regardless of size. 10 to 10240, default 100.
Retention Period (days)Rotated files older than this are deleted at the next rotation. 1 to 3650, default 7.
Compress Rotated FilesCompresses with gzip. On by default.

The screen shows the expected disk usage. The file list offers Preview, Download and Delete, and Manual Rotate rotates immediately.

Archive directory (another disk or NAS)

Rotated files can be moved to another disk or a NAS to free the log disk.

  1. Mount the shared folder on the host (with nofail in fstab).
  2. Bind that folder to /archive in the api service of docker-compose.yml and recreate the container.
services:
  api:
    volumes:
      - /mnt/nas/npg-raw-logs:/archive
  1. In the archive card on Logs → Raw Files, click Check; if the file system and size shown are right, click Use this directory.
  2. Turn on Move rotated raw logs to the archive directory and save.

Only files that are compressed and have not changed for a while are moved. If the archive directory cannot be used (not mounted, not writable, out of space and so on), the files stay on the log disk and the card shows the status. Archive retention is 1 to 3650 days, default 365.

Backup and restore

Settings → Backups backs up and restores the NPG configuration as a .tar.gz file. The procedure around version updates is in Updating and backups.

Settings → Backups with auto backup settings and the backup history
Settings → Backups with auto backup settings and the backup history

Create Backup takes a description and Include Configuration Files, Include SSL Certificates and Include Database. Backups in Backup History can be downloaded, restored or deleted. Files are stored in /app/data/backups inside the API container (the npg_api_data volume).

In Auto Backup Settings, turn on Enable Auto Backup and set the Backup Schedule (Cron) (default 0 2 * * *, daily at 2 a.m.) and the Backup Retention Count (default 10; the oldest backups are deleted beyond that). A failing scheduled backup can be sent as the Scheduled backup failed notification.

A backup from another server is uploaded with Upload & Restore. The upload limit is about 100 MB.

Included in a backupNot included
Proxy hosts with their security settings and log collection rulesUser accounts and role assignments
Redirect hosts, access lists, auth providers (ForwardAuth)API tokens
Certificates (with private keys), DNS providers (with credentials)Notification channels
WAF settings and exclusions, banned IPs, URI blocks, exploit rulesLog data such as access logs
Global security defaults, global Fail2ban, CAPTCHA settingsSSO identity links
Filter subscriptions, DDNS records, cloud providers
Global settings, system settings, error pages, Cloudflare Tunnel settings
Roles, SSO providers

A restore overwrites the current configuration with the backup's. When it finishes, reload the page and assign roles to your users again.