多服务 Nginx 反向代理配置与细节总结
在复杂的多服务服务器环境中,通过子域名和 Nginx 反向代理将不同内网服务安全、高效地发布到公网,是一种常见且实用的架构方案。以下是一份详细的配置总结,涵盖了常用服务(如 Nextcloud、Rocket.Chat、WordPress、PVE、PBS、Webmin、Stirling PDF、phpMyAdmin、Portainer、Plex 等)在 Nginx 上的实践配置与要点。 ✅ 核心思路 ✅ 通用配置结构 server { listen 80; server_name example.com; return 301 https://$host$request_uri;}server { listen 443 ssl http2; server_name example.com; client_max_body_size 200M; ssl_certificate /path/to/fullchain.pem; ssl_certificate_key /path/to/privkey.pem; ssl_protocols TLSv1.2 TLSv1.3; location / { proxy_pass http://192.168.x.x:port/; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection “upgrade”; …