Files
aiagent/backend/nginx-reverse-proxy.conf

42 lines
1.1 KiB
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Nginx 反向代理配置示例
server {
listen 80;
server_name example.com; # 替换为你的域名或IP
# 日志配置(可选)
access_log /var/log/nginx/proxy_access.log;
error_log /var/log/nginx/proxy_error.log;
location / {
# 代理到后端服务
proxy_pass http://127.0.0.1:8080; # 替换为实际后端地址
# 传递原始请求头
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;
# 超时设置(可选)
proxy_connect_timeout 30s;
proxy_read_timeout 60s;
proxy_send_timeout 60s;
}
# 静态资源直接由Nginx处理(可选)
location /static/ {
alias /var/www/static/;
expires 7d;
}
# WebSocket 反向代理(可选)
location /ws/ {
proxy_pass http://127.0.0.1:8081;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
}
}