This article will introduce Nginx Proxy Manager
hosts
Common Features
Proxy Hosts
Port Reverse Proxy Purpose: Port masking
1. Apply for an SSL certificate. You must prepare the API for the corresponding provider's DNS in advance.


2. Add domain name and reverse proxy port settings, check all boxes, and use the obtained SSL certificate


Red ire ction Hosts
Simply put : Proxy Hosts " silently" redirect traffic to backend servers while keeping the domain name visible in the user's browser unchanged. Redirection Hosts directly inform the browser: "The resource you're seeking has moved; please visit this new address." This causes the domain name displayed in the user's browser to change (the accessed domain automatically redirects to another domain).
Here are its core applications:
1. Domain Migration and "Whitewashing"
If you're switching from an old domain (e.g., old-site.com ) to a new one ( new-site.com ), you definitely don't want existing users to see a 404 error when they visit.
- Purpose: Set up a redirect host to automatically redirect all requests to the old domain to the new domain.
- Benefits: Retain existing customers while signaling to search engines (via 301 redirects ) that your site's authority has transferred to the new domain.
2. Branding External Links
Sometimes you use third-party services with long, hard-to-remember URLs.
- Purpose:
- Redirect docs.yourname.com to your Notion document page
- Redirect blog.yourname.com to your Zhihu column or Medium page
- Redirect nas.yourname.com to a specific dynamic IP port on your home broadband
- Benefits: Users only need to remember your domain name, not that long string of third-party links.
3. Forcing HTTP to HTTPS Redirects
Although NPM's proxy host includes "Force SSL, " if you have more complex redirect logic:
- Purpose: Force any domain to redirect to an encrypted address or to the HTTPS version of another domain.
4. Domain normalization (remove www or add www)
For SEO (search engine optimization), you may want only one entry point for your entire site.
- Purpose: Redirect www.example.com to example.com (or vice versa).
- Benefits: Prevents search engines from treating them as duplicate sites and consolidates traffic weight.
5. Temporary Maintenance Notice
- Purpose: When your main site is down for maintenance, temporarily redirect the domain to a static "Under Maintenance" page (e.g., hosted on GitHub Pages).
Streams Port Forwarding
When the port used for reverse proxy access is unavailable, append a backup port suffix to the URL to access the site.
404 Hosts
In Nginx Proxy Manager (NPM), the "404 Hosts" feature serves a relatively singular and explicit purpose: its core function is to draw a definitive "full stop" for specific domains, explicitly informing visitors (or crawlers) that the address does not exist. You can think of it as a "rejection notice" or a "false address sign. "
Here are its specific uses:
1. Explicitly reject invalid or abandoned domains
If your server IP is bound to multiple domains, or if outdated domains still point to your server but you no longer wish to provide service:
- Purpose: Add these domains to your 404 Hosts configuration.
- Effect: When someone attempts to access these domains, Nginx will directly return a 404 Not Found error without attempting to connect to any backend Docker containers or server resources.
2. Preventing information leaks via the "default site"
If you haven't configured 404 hosts, Nginx typically displays "Default Site" when an unconfigured domain points to your server.
- Purpose: By configuring 404 hosts, you can precisely control which domains should fail immediately.
- Benefits: Prevents scanning tools from discovering other services in your backend. It's cleaner than the default site and avoids exposing NPM's welcome page.
3. Save Server Resources
- Purpose: Unlike a "Proxy Host," a 404 Host requires no backend connections (Upstream).
- Effect: Traffic is blocked at the Nginx layer. If scrapers or bots continuously access invalid domains, setting them as 404 Hosts significantly reduces CPU and bandwidth pressure.
4. Customize 404 Pages
In NPM's 404 Host settings, you can choose the returned content:
- Default 404: Nginx's standard blank error page.
- Custom HTML: You can write a message like "This site has permanently closed" or "Please contact us through official channels," or even display a humorous image.
Summary: Differences Between the Three Hosts
To clarify, here's a comparison:
Host Type | Your Command | Result |
Proxy Host | "Go to the container named Web1 in the backend." | Successful Access |
Redirection Host | "Nothing here. Go to that new URL." | Redirected |
404 Host | "Nothing here. Don't come back." | Direct error |
When would you use it?
- Scenario A: You bought a new domain but haven't decided what to do with it yet. Since the domain resolution is already active, you can temporarily place it in 404 Hosts to reserve the spot.
- Scenario B: A malicious site mirrors your website. You redirect its domain to your IP address and use 404 Hosts to block it completely.
- Scenario C: You've discontinued a service and want the original domain to become completely invalid, rather than redirecting to the homepage.
ACCESS LISTS
Implement password-protected site access to block unauthorized users, along with IP whitelisting/blacklisting.
Applicable for: websites without password protection, IP blocking

Add Block Rules

Configure rules

After selecting the desired rules, save your settings
For usage questions, feel free to leave comments in the section below for discussion~
- 作者:Sxiaoai
- 链接:https://sxiaoai.512778.xyz/Technical%20sharing/%20Nginx-Proxy-Manager%2Cb
- 声明:本文采用 CC BY-NC-SA 4.0 许可协议,转载请注明出处。
相关文章



