# Nginx 反代配置样例 —— 测试环境 hrstest.opencomputing.cn # T02b:反代后端已由 127.0.0.1:9182 修正为 127.0.0.1:9280(客户确认端口变更) # 部署位置:/etc/nginx/conf.d/hrstest.conf(实际远程部署留待部署任务执行) # HTTPS:预留 certbot --nginx 自动改写(执行后 certbot 会新增 listen 443 ssl 块、 # 注入 ssl_certificate/ssl_certificate_key,并在 80 块加 301 跳转,勿手工预写证书路径) server { listen 80; listen [::]:80; server_name hrstest.opencomputing.cn; # 上传/附件体积上限(合同附件、花名册导入等场景预留) client_max_body_size 50m; # 访问/错误日志 access_log /var/log/nginx/hrstest.access.log; error_log /var/log/nginx/hrstest.error.log; location / { proxy_pass http://127.0.0.1:9280; proxy_http_version 1.1; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; # WebSocket / 长连接预留(消息通道、审批待办推送) proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_read_timeout 300s; } } # ── certbot 操作备忘(部署任务执行时)──────────────────────────── # sudo certbot --nginx -d hrstest.opencomputing.cn # certbot 会自动改写本文件为 443/ssl 配置并配置 80→443 跳转 # MariaDB(3306)/Redis(6379) 仅本机/内网监听,不经 Nginx 暴露