| worker_processes auto; # 工作进程数,auto 表示由 Nginx 自动检测 CPU 核心数 | |
| # 错误日志 | |
| # error_log /var/log/nginx/error.log warn; | |
| # pid /var/run/nginx.pid; # Nginx master 进程的 PID 文件 | |
| # 事件块 | |
| events { | |
| # 每个工作进程可以同时处理的最大连接数 | |
| worker_connections 1024; | |
| # 使用哪种事件模型,Linux上通常是epoll | |
| # use epoll; | |
| } | |
| http{ | |
| server { | |
| listen 7860 default_server; | |
| listen [::]:7860 default_server; | |
| server_name _; | |
| location / { | |
| proxy_pass http://localhost:3000; | |
| } | |
| proxy_set_header Authorization $http_my_auth; | |
| # 常用的一些反向代理头,确保后端能正确获取客户端信息 | |
| 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; | |
| } | |
| } | |