34 lines
1.2 KiB
Plaintext
34 lines
1.2 KiB
Plaintext
|
|
upstream agent_backend {
|
||
|
|
server 172.24.16.10:8070 max_fails=3 fail_timeout=30s; # 机器A服务
|
||
|
|
server 172.24.16.7:8070 max_fails=3 fail_timeout=30s; # 机器B服务
|
||
|
|
keepalive 300;
|
||
|
|
}
|
||
|
|
|
||
|
|
server {
|
||
|
|
listen 1070;
|
||
|
|
|
||
|
|
location / {
|
||
|
|
proxy_pass http://agent_backend;
|
||
|
|
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_http_version 1.1;
|
||
|
|
proxy_set_header Connection "";
|
||
|
|
|
||
|
|
# 允许跨域
|
||
|
|
add_header 'Access-Control-Allow-Origin' "$http_origin" always;
|
||
|
|
add_header 'Access-Control-Allow-Credentials' 'true' always;
|
||
|
|
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS, PUT, DELETE' always;
|
||
|
|
add_header 'Access-Control-Allow-Headers' 'Authorization,Content-Type,X-Requested-With,Accept,Origin' always;
|
||
|
|
# 处理预检请求
|
||
|
|
if ($request_method = OPTIONS ) {
|
||
|
|
return 204;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
nohup /data/jdk-21.0.7/bin/java -jar /data/webapps/flymoon_payment/flymoon-payment.jar --spring.profiles.active=prod >/data/webapps/flymoon_payment/nohup.out 2>&1 &
|