93 lines
3.0 KiB
Plaintext
93 lines
3.0 KiB
Plaintext
# ============================================================
|
||
# Genex API Gateway — Nginx 反向代理
|
||
# 海外: api.gogenex.com → 154.84.135.121 → Kong 192.168.1.222:48080
|
||
# 国内: api.gogenex.cn → 14.215.128.96 → Kong 192.168.1.222:48080
|
||
# (gogenex.cn 需备案后才能走 80/443 端口)
|
||
# ============================================================
|
||
|
||
upstream genex_kong {
|
||
server 192.168.1.222:48080;
|
||
keepalive 32;
|
||
}
|
||
|
||
# --- HTTP: 保留用于 ACME 验证 + 301 跳转 ---
|
||
server {
|
||
listen 80;
|
||
listen [::]:80;
|
||
server_name api.gogenex.cn api.gogenex.com
|
||
admin.gogenex.cn admin.gogenex.com
|
||
ws.gogenex.cn ws.gogenex.com;
|
||
|
||
# Let's Encrypt ACME 验证路径
|
||
location /.well-known/acme-challenge/ {
|
||
root /var/www/certbot;
|
||
}
|
||
|
||
# HTTP → HTTPS 301 跳转(有证书的域名)
|
||
location / {
|
||
return 301 https://$host$request_uri;
|
||
}
|
||
}
|
||
|
||
# --- HTTPS: api.gogenex.com ---
|
||
server {
|
||
listen 443 ssl http2;
|
||
listen [::]:443 ssl http2;
|
||
server_name api.gogenex.com;
|
||
|
||
ssl_certificate /etc/letsencrypt/live/api.gogenex.com/fullchain.pem;
|
||
ssl_certificate_key /etc/letsencrypt/live/api.gogenex.com/privkey.pem;
|
||
ssl_protocols TLSv1.2 TLSv1.3;
|
||
ssl_ciphers HIGH:!aNULL:!MD5;
|
||
ssl_prefer_server_ciphers on;
|
||
|
||
location / {
|
||
proxy_pass http://genex_kong;
|
||
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 "";
|
||
|
||
proxy_connect_timeout 10s;
|
||
proxy_send_timeout 60s;
|
||
proxy_read_timeout 60s;
|
||
|
||
# WebSocket 支持(交易推送 / AI Agent 等)
|
||
proxy_set_header Upgrade $http_upgrade;
|
||
proxy_set_header Connection "upgrade";
|
||
}
|
||
}
|
||
|
||
# --- HTTPS: admin.gogenex.com + ws.gogenex.com ---
|
||
# (DNS 传播后申请证书,再取消注释)
|
||
# server {
|
||
# listen 443 ssl http2;
|
||
# listen [::]:443 ssl http2;
|
||
# server_name admin.gogenex.com ws.gogenex.com;
|
||
#
|
||
# ssl_certificate /etc/letsencrypt/live/admin.gogenex.com/fullchain.pem;
|
||
# ssl_certificate_key /etc/letsencrypt/live/admin.gogenex.com/privkey.pem;
|
||
# ssl_protocols TLSv1.2 TLSv1.3;
|
||
# ssl_ciphers HIGH:!aNULL:!MD5;
|
||
# ssl_prefer_server_ciphers on;
|
||
#
|
||
# location / {
|
||
# proxy_pass http://genex_kong;
|
||
# 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 "";
|
||
#
|
||
# proxy_connect_timeout 10s;
|
||
# proxy_send_timeout 60s;
|
||
# proxy_read_timeout 60s;
|
||
#
|
||
# proxy_set_header Upgrade $http_upgrade;
|
||
# proxy_set_header Connection "upgrade";
|
||
# }
|
||
# }
|