tips
32 tips Nginx Proxy Manager
One command, setting or habit at a time about Nginx Proxy Manager: what it does, the line to copy and a caveat or two.
Nginx Proxy Manager 32
-
A custom file that Nginx Proxy Manager includes at the end of every redirection server block.
/data/nginx/custom/server_redirect.conf -
Explains what the HSTS switches in NPM send and why they stick for two years.
Strict-Transport-Security: max-age=63072000; preload -
Limits a proxy host to addresses you list, without asking for any password.
allow 192.0.2.0/24; -
Add global nginx settings to Nginx Proxy Manager that survive updates.
docker compose restart npm -
Replaces the default weekly log rotation of Nginx Proxy Manager with your own file.
services: -
Explains what the Block Common Exploits switch blocks and why it can cause a 403 in your app.
include conf.d/include/block-exploits.conf; -
Gets one wildcard certificate for all your subdomains in Nginx Proxy Manager without opening port 80.
dns_cloudflare_api_token=0123456789abcdef0123456789abcdef01234567 -
Blocks visitors from outside the countries you choose on selected Nginx Proxy Manager hosts.
load_module /usr/lib/nginx/modules/ngx_http_geoip2_module.so; -
Shows how to upgrade Nginx Proxy Manager on purpose, with a pinned image version.
image: 'jc21/nginx-proxy-manager:2.17.0' -
Explains why a password on a proxy host breaks apps that have their own login.
-
Runs Nginx Proxy Manager as a regular user instead of root and fixes folder ownership.
environment: -
Adds a Docker health check so Nginx Proxy Manager shows healthy or unhealthy in docker ps.
healthcheck: -
Makes Nginx Proxy Manager read its database password from a file instead of the compose file.
environment: -
Stops Nginx Proxy Manager downloading CDN IP ranges at startup, which helps when internet access is limited.
environment: -
Allows Nginx Proxy Manager hosts to be shown in iframes from the same origin.
environment: -
Limits how many requests per second one client can send to your Nginx Proxy Manager hosts.
limit_req_zone $binary_remote_addr zone=npmlimit:10m rate=10r/s; -
Raises the upload size limit on all Nginx Proxy Manager proxy hosts, so big uploads stop failing with 413.
client_max_body_size 10g; -
Changes the port of the Nginx Proxy Manager admin page from 81 to one you choose.
ports: -
Stops Nginx Proxy Manager from using IPv6 on a host that has IPv6 turned off.
environment: -
Lets Nginx Proxy Manager reach other containers by name, so they need no published host ports.
docker network create scoobydoo -
Creates the first Nginx Proxy Manager admin from your compose file, so there is no setup screen.
environment: -
Keeps the Portainer service on the Swarm node where its data volume is stored.
docker node ls -
Prints the hostnames, issuer and dates of a certificate file in one line of commands.
openssl x509 -in fullchain.pem -noout -subject -issuer -dates -ext subjectAltName -
Uses named service profiles to open the right ports with one word.
sudo ufw app list -
Removes the nginx version number from the Server header and error pages.
server_tokens off; -
Skips chosen requests, such as health checks, when writing the access log.
access_log /var/log/nginx/access.log combined if=$loggable; -
Adds request and upstream timing to each access log line.
log_format timed '$remote_addr "$request" $status $body_bytes_sent ' -
Explains why headers set in the server block disappear inside a location with its own add_header.
add_header X-Content-Type-Options nosniff always; # server block -
Tells browsers to keep static files for 30 days and skip repeat downloads.
expires 30d; -
Compresses CSS, JavaScript and JSON responses, which nginx skips by default.
gzip on; -
Limits how often one client address may request a path and returns 429 beyond that.
location = /login { limit_req zone=login burst=5 nodelay; -
Prints the complete configuration nginx would load, with each included file marked.
sudo nginx -T | less
Nothing in this filter yet.