更换家庭网络后NGINX代理配置及192.168.1.1/24地址位错误咨询
Got it, let's sort out your NGINX config issues step by step—you've got two problems here: the invalid subnet mask error, and updating your allowed home IP range to the new 19.16.x.x network.
First: Fix the "Low Address Bit Meaningless" Error
That error pops up because you used a specific IP (192.168.0.1) with a /24 subnet mask. A /24 mask covers an entire range of IPs (from 192.168.0.0 to 192.168.0.255), so you need to use the network address (the first IP in the range) instead of a single device's IP.
So instead of allow 192.168.0.1/24;, you should write:
allow 192.168.0.0/24;
If you don't need access from the old 192.168.0.x network anymore, you can just delete this line entirely.
Second: Add Your New 19.16.x.x Home Network
Since your new ISP router uses a 19.16.x.x subnet, you need to add this to the allow rules. The exact mask depends on how your router assigns IPs:
- If it's a standard home subnet (like 19.16.1.0 to 19.16.1.255), use
allow 19.16.1.0/24; - If your ISP assigns a wider range (all 19.16.x.x addresses), use
allow 19.16.0.0/16;
Final Working Config
Here's the updated config with both fixes applied (adjust the 19.16 mask to match your actual network):
location /plexpy { proxy_pass http://127.0.0.1:8181/plexpy; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; satisfy any; # Allow your new 19.16 home network (adjust mask as needed) allow 19.16.0.0/16; # Optional: Allow old 192.168.0.x network (fixed mask) # allow 192.168.0.0/24; auth_basic "closed site"; auth_basic_user_file .htpasswd; }
Quick Test & Apply
Before reloading NGINX, always check for config errors with:
nginx -t
If it says "test is successful", reload the service to apply changes:
sudo systemctl reload nginx
This setup will let you bypass Basic Auth when you're on your new home network, while still requiring authentication for external access—just like you wanted.
内容的提问来源于stack exchange,提问作者Phairplay

