Nginx Proxy Guard

Features

Proxy hosts

A proxy host forwards HTTP/HTTPS requests for the domains you give it to an internal server or Docker container. Each host becomes one nginx server block, and its SSL, security, caching and load-balancing settings go into that block.

TCP/UDP stream hosts are created on the same screen; they are covered in TCP/UDP streams. If this is your first host, Your first proxy host is the quicker start.

The list

Open Proxy Hosts in the top menu to see your hosts.

Proxy host list with tags, status and SSL badges
Proxy host list with tags, status and SSL badges
  • Find hosts with Search hosts... and sort by name, last update or creation date.
  • Filter the list by tags, domain, upstream and status. Clicking a tag filters by it.
  • Each row shows the host status (Active, Disabled, Error) and the backend status (Backend online, Backend offline). Error means the last attempt to apply the configuration failed; hover over it to see the error nginx reported.
  • The row actions are edit, enable/disable, test configuration, clone, delete and favorite.

Test Configuration sends a real request to the host and shows the status code, protocol, SSL certificate, cache status and security headers.

Tabs in the edit dialog

Click Add Proxy Host, or the edit button on a row, to open the edit dialog.

TabContents
BasicProxy mode, domains, tags, target (scheme, host, port), DDNS auto-registration
SSL/TLSSSL on/off, choose a certificate or issue a new one, Force HTTPS, HTTP/2, HTTP/3
SecurityPriority Allow IPs, Block Exploits, Fail2ban, WAF, Access List, Auth Provider (SSO), Bot Filter, GeoIP Restriction, Cloud Provider Blocking
ProtectionRate limit, link to the Fail2ban settings, security headers, this host's banned IPs
PerformanceWebSocket support, caching, proxy settings override (body size, buffering)
Load BalancingSeveral backend servers and the distribution method
AdvancedCustom Nginx Configuration

The Protection and Load Balancing tabs work once the host has been saved. For a new host, save it first, then open it again from the list.

Basic tab

Basic tab: domain, forward scheme, host and port
Basic tab: domain, forward scheme, host and port
FieldMeaningDefault
Proxy ModeHTTP / HTTPS (virtual host reverse proxy) or TCP / UDP Stream (layer 4 reverse proxy)HTTP / HTTPS
Domain NamesThe addresses visitors use. You can add several, and wildcards such as *.example.com are accepted.none
TagsLabels for grouping the list. Up to 10 per host, lowercase letters, digits, ., _ and -, starting with a letter or digit (at most 32 characters).none
Forward SchemeThe protocol used to talk to the internal service. Choose https only if the service terminates TLS itself.http
Forward HostIP address, hostname or container name of the internal servicenone
Forward PortThe port the internal service listens on (1-65535)80
DDNS Auto-RegistrationCreates managed DDNS records for this host's domains that follow public IP changes. Cloudflare, DuckDNS, Dynu and Infomaniak providers can be used.off

Choosing a Docker container

Browse Docker Containers opens a list of running containers attached to bridge networks. Pick a container, network and port, and the forward host and port are filled in.

Docker container picker
Docker container picker

A host bound to a container looks its IP up by name. By default NPG checks the container IP every 30 seconds and regenerates the configuration when it changes. If the container cannot be found, the last working configuration stays in place. Networking and proxying the admin interface itself are covered in Connecting Docker containers.

SSL/TLS tab

SSL/TLS tab: certificate, Force HTTPS, HTTP/2, HTTP/3
SSL/TLS tab: certificate, Force HTTPS, HTTP/2, HTTP/3
FieldMeaningDefault
SSL EnabledTurns HTTPS on for this host. Turning it on also turns on HTTP/2.off
CertificateUse Existing Certificate picks an issued or uploaded certificate; Create New Certificate creates a Let's Encrypt or self-signed certificate when you save.none
Force HTTPSRedirects HTTP requests to HTTPS.off
HTTP/2Uses HTTP/2 on HTTPS connections.on once SSL is on
HTTP/3Accepts HTTP/3 over QUIC (UDP) and announces it to browsers with an Alt-Svc header.off
  • When you create a certificate here, Let's Encrypt uses either the HTTP challenge (port 80) or a DNS challenge with one of your DNS providers, and you choose the key type (RSA 2048, ECDSA P-256, ECDSA P-384). Wildcard domains need the DNS challenge. See SSL certificates.
  • HTTP/3 only works if UDP port 443 reaches the server. If your router or firewall forwards only TCP 443, browsers connect over HTTP/2.
  • TLS details such as protocols, cipher suites and key exchange curves are set for all hosts under Settings → Global Settings → SSL/TLS, not per host.

Security tab

Security tab: WAF mode, GeoIP and bot filter sections
Security tab: WAF mode, GeoIP and bot filter sections

Each section of the Security tab is covered on its own page.

SectionWhat it doesPage
Priority Allow IPsIPs, ranges and domains listed here skip the GeoIP restriction, cloud blocking and the bot filter.Geo and cloud blocking
Block ExploitsBlocks known patterns (SQL injection, XSS, path traversal, scanners) in nginx. New hosts start with it on.Automatic bans
Fail2ban (Auto IP Ban)Bans an IP on this host when it keeps getting the chosen error responses. Shown on saved hosts only.Automatic bans
WAF (Web Application Firewall)Inherit, override or disable ModSecurity, plus mode, paranoia level and thresholdWAF
Access ListThe access list this host usesAccess lists
Auth Provider (SSO)The ForwardAuth provider in front of this host, and paths left open without loginForwardAuth
Bot FilterBlocking by User-AgentBot filter
GeoIP RestrictionBlock or allow countries, challenge modeGeo and cloud blocking
Cloud Provider BlockingBlock cloud provider IP ranges, challenge modeGeo and cloud blocking
Access list selection on the Security tab
Access list selection on the Security tab

WAF, bot filter, GeoIP restriction, cloud blocking, rate limit and security headers each offer Inherit / Override / Disable. Inherit follows the global default under WAF / Blocking, Override uses only this host's values, and Disable turns the feature off regardless of the global default. A new host's WAF starts as Disable, so choose Inherit if it should follow the global WAF. See Global security defaults.

Protection tab

On a saved host, set the rate limit and security headers to inherit, override or disable, and see the IPs banned on this host. Fail2ban details (max retries, ban time and so on) are changed through the link on this tab or under WAF / Blocking → Fail2ban. Rate limits and security headers are covered in Security headers and rate limits.

Performance tab

FieldMeaningDefault
WebSocket SupportPasses WebSocket upgrade requests to the backend.on
Enable CacheCaches responses in nginx. The X-Cache-Status response header shows HIT or MISS.off
Static Assets OnlyCaches only js, css, images and fonts. When off, every response except /api/* is cached.on
Cache Duration30 minutes, 1 hour, 6 hours, 1 day, 7 days, 30 days7 days
Client Max Body SizeMaximum size of a request body such as an upload. 0 is unlimited; values look like 100m or 1g.global value when empty
Proxy Max Temp File SizeMaximum size of the temp file used while buffering a response. 0 disables temp files.global value when empty
Proxy BufferingWhen off, responses stream to the client without buffering (SSE, large downloads).Use global setting
Proxy Request BufferingWhen off, uploads are passed to the backend as they arrive.Use global setting

On a host with the WAF on, the whole request body is read for inspection, so turning request buffering off does not make uploads stream. For large uploads and long-lived connections see Large uploads, WebSockets and timeouts.

Load Balancing tab

Load Balancing tab with two backend servers
Load Balancing tab with two backend servers

Spreads requests over several backend servers. Add at least one server and click Save inside the tab; requests then go to this server list instead of the forward host on the Basic tab. Delete Upstream switches back to single-server mode.

FieldMeaningDefault
ProtocolThe protocol used to reach the backends. With HTTPS, backend certificates are not verified, so self-signed certificates work.HTTP
MethodRound Robin, Least Connections, IP Hash (session persistence), RandomRound Robin
Keepalive ConnectionsIdle connections kept open to the backends32
Backend ServersAddress, port, weight, and whether the server is a backupnone

Enable Health Check only stores its values; no active check runs. A server that does not answer is left out for a short while by nginx's default behaviour.

Advanced tab

Advanced tab: Custom Nginx Configuration
Advanced tab: Custom Nginx Configuration

Directives in Custom Nginx Configuration are placed inside the location / { ... } block. If the text contains a location block, the whole text is placed in the server { ... } block instead, which is how you add per-path settings (custom locations).

location /api/ {
    proxy_pass http://192.0.2.20:8080;
    proxy_read_timeout 3600;
}

Directives that could bypass the security features or reach outside the host are refused when you save, for example include, load_module, Lua, Perl and njs scripting, ssl_certificate, access_log, error_log, modsecurity, SecRule, satisfy and error_page 403. A syntax error makes nginx -t fail and puts the host in the Error status.

Cloning

Clone in the list copies a host to new domains. You set the new domain names, the forward scheme, host and port (or a Docker container), and the certificate (the same certificate as the source, an existing one, a newly issued one, or none). The GeoIP restriction, rate limit, security headers, bot filter, upstream servers, URI block rules and WAF rule exclusions are copied too, and the upstream gets a name of its own.

Saving and applying

On save, NPG stores the settings in the database, generates the nginx configuration, tests it with nginx -t and reloads. If nginx refuses the new configuration, the host stays saved and the save dialog shows why. nginx keeps running with the previous configuration.

Interaction with other features

  • ForwardAuth and challenges: nginx allows only one authentication subrequest per location. Choosing an Auth Provider disables the GeoIP and cloud challenge modes, and turning a challenge on clears the Auth Provider. A host whose Advanced Config has a location / block cannot use an Auth Provider.
  • Access lists with usernames and passwords: such a list cannot be used on a host with ForwardAuth, and the GeoIP and cloud challenges of the hosts that use it block instead.
  • Global trusted IPs: the global trusted IPs under Settings → WAF Auto-Ban skip GeoIP, access lists, the bot filter and rate limits. The full table of exemptions is in Trusted IPs, exceptions and precedence.

Limits

  • A proxy host forwards to one backend (or one load-balancing server list). To send different paths to different backends, write location blocks on the Advanced tab.
  • The load-balancing health check is stored but not run.
  • HTTP/3 needs UDP port 443 to be open.
  • Certificate and log paths, WAF rules and similar items cannot be changed through the Advanced Config; change them on their own screens.