81 lines
2.4 KiB
Nginx Configuration File
81 lines
2.4 KiB
Nginx Configuration File
# 默认服务器配置已移至 HTTPS 服务器块
|
|
|
|
server {
|
|
listen 80;
|
|
server_name banban.api.talkingq.com;
|
|
|
|
# HTTP 跳转到 HTTPS
|
|
location / {
|
|
return 301 https://$host$request_uri;
|
|
}
|
|
|
|
# Let's Encrypt HTTP-01 校验
|
|
location /.well-known/acme-challenge/ {
|
|
root /var/www/certbot;
|
|
}
|
|
}
|
|
|
|
server {
|
|
listen 443 ssl;
|
|
server_name banban.api.talkingq.com;
|
|
|
|
ssl_certificate /etc/letsencrypt/live/banban.api.talkingq.com/fullchain.pem;
|
|
ssl_certificate_key /etc/letsencrypt/live/banban.api.talkingq.com/privkey.pem;
|
|
ssl_protocols TLSv1.2 TLSv1.3;
|
|
ssl_ciphers HIGH:!aNULL:!MD5;
|
|
|
|
access_log /var/log/nginx/access.log;
|
|
error_log /var/log/nginx/error.log;
|
|
|
|
# 服务号网页授权域名校验文件
|
|
location = /MP_verify_9ixdRu6JqQrntouG.txt {
|
|
root /usr/share/nginx/html;
|
|
}
|
|
|
|
# 旧的微信校验文件路径
|
|
location = /msUqvicTHS.txt {
|
|
root /usr/share/nginx/html;
|
|
}
|
|
|
|
# 扫普通链接二维码打开小程序:qrcode/bind 规则校验文件
|
|
location = /qrcode/bind/HXNd3XMbPq.txt {
|
|
root /usr/share/nginx/html;
|
|
}
|
|
|
|
# 扫普通链接二维码打开小程序:bind-qr 规则校验文件
|
|
location = /bind-qr/msUqvicTHS.txt {
|
|
root /usr/share/nginx/html;
|
|
}
|
|
|
|
# WebSocket 请求需要显式转发协议升级头
|
|
location = /ws {
|
|
proxy_pass http://101.35.224.118:8080;
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
proxy_set_header Connection "upgrade";
|
|
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;
|
|
}
|
|
|
|
# API 请求转发到后端服务
|
|
location / {
|
|
proxy_pass http://101.35.224.118: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_set_header X-Original-URI $request_uri;
|
|
proxy_set_header Authorization $http_authorization;
|
|
add_header Cache-Control "no-store, no-cache, must-revalidate";
|
|
expires -1;
|
|
}
|
|
|
|
error_page 500 502 503 504 /50x.html;
|
|
|
|
location = /50x.html {
|
|
root /usr/share/nginx/html;
|
|
}
|
|
}
|