196 lines
6.2 KiB
Plaintext
196 lines
6.2 KiB
Plaintext
|
|
# 1. 强制将 jennie.deal 跳转到 www.jennie.deal(HTTP)
|
|||
|
|
server {
|
|||
|
|
listen 80;
|
|||
|
|
server_name jennie.deal;
|
|||
|
|
return 301 https://www.jennie.deal$request_uri;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
# 2. 强制将 jennie.deal 跳转到 www.jennie.deal(HTTPS)
|
|||
|
|
server {
|
|||
|
|
listen 443 ssl;
|
|||
|
|
server_name jennie.deal;
|
|||
|
|
ssl_certificate /data/tengine/conf/certificate/jennie.deal.crt;
|
|||
|
|
ssl_certificate_key /data/tengine/conf/certificate/jennie.deal.key;
|
|||
|
|
ssl_protocols TLSv1.2 TLSv1.3;
|
|||
|
|
ssl_ciphers HIGH:!aNULL:!MD5;
|
|||
|
|
return 301 https://www.jennie.deal$request_uri;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
# 3. 主站点 www.jennie.deal 的服务入口(HTTP -> HTTPS 跳转)
|
|||
|
|
server {
|
|||
|
|
listen 80;
|
|||
|
|
server_name www.jennie.deal;
|
|||
|
|
return 301 https://www.jennie.deal$request_uri;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
# 4. www.jennie.deal 正常提供服务(HTTPS)
|
|||
|
|
server {
|
|||
|
|
listen 443 ssl;
|
|||
|
|
server_name jennie.deal www.jennie.deal;
|
|||
|
|
ssl_certificate /data/tengine/conf/certificate/jennie.deal.crt;
|
|||
|
|
ssl_certificate_key /data/tengine/conf/certificate/jennie.deal.key;
|
|||
|
|
ssl_protocols TLSv1.2 TLSv1.3;
|
|||
|
|
ssl_ciphers HIGH:!aNULL:!MD5;
|
|||
|
|
|
|||
|
|
location / {
|
|||
|
|
root /data/tengine/html/jennie_web/dist/;
|
|||
|
|
index index.html index.htm;
|
|||
|
|
try_files $uri $uri/ /index.html;
|
|||
|
|
}
|
|||
|
|
error_page 500 502 503 504 /50x.html;
|
|||
|
|
location = /50x.html {
|
|||
|
|
root html;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
# 处理 /test-api/xxx(除 jenniefy 之外的请求),转发到 43.139.181.45:5001
|
|||
|
|
location /test-api/ {
|
|||
|
|
proxy_pass http://127.0.0.1:5001;
|
|||
|
|
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_intercept_errors off;
|
|||
|
|
|
|||
|
|
# # 关闭响应缓冲
|
|||
|
|
proxy_buffering off;
|
|||
|
|
proxy_cache off;
|
|||
|
|
proxy_set_header Connection keep-alive;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
location /prod-api/ {
|
|||
|
|
proxy_pass http://127.0.0.1:5001;
|
|||
|
|
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_intercept_errors off;
|
|||
|
|
|
|||
|
|
# # 关闭响应缓冲
|
|||
|
|
proxy_buffering off;
|
|||
|
|
proxy_cache off;
|
|||
|
|
proxy_set_header Connection keep-alive;
|
|||
|
|
|
|||
|
|
# 允许跨域
|
|||
|
|
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;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
# -----------新的s2.jennie.im 单机前后端同一台-------------------------------
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
server {
|
|||
|
|
listen 443 ssl;
|
|||
|
|
server_name s2.jennie.mi;
|
|||
|
|
ssl_certificate /data/tengine/conf/certificate/jennie.im.crt;
|
|||
|
|
ssl_certificate_key /data/tengine/conf/certificate/jennie.im.key;
|
|||
|
|
ssl_protocols TLSv1.2 TLSv1.3;
|
|||
|
|
ssl_ciphers HIGH:!aNULL:!MD5;
|
|||
|
|
|
|||
|
|
# 单独日志文件
|
|||
|
|
access_log /data/tengine/logs/s2.jennie.im_access.log;
|
|||
|
|
error_log /data/tengine/logs/s2.jennie.im_error.log;
|
|||
|
|
|
|||
|
|
location /api/ {
|
|||
|
|
proxy_pass http://127.0.0.1:7001;
|
|||
|
|
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_buffering off;
|
|||
|
|
proxy_cache off;
|
|||
|
|
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;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
# 前端静态文件
|
|||
|
|
location / {
|
|||
|
|
root /data/tengine/html/jennie-frontend/dist;
|
|||
|
|
index index.html;
|
|||
|
|
|
|||
|
|
try_files $uri $uri/ /index.html;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
# 缓存控制,确保 JS 文件不缓存老内容
|
|||
|
|
location ~* \.(js|css|woff2|json|svg)$ {
|
|||
|
|
root /data/tengine/html/jennie-frontend/dist;
|
|||
|
|
# expires off;
|
|||
|
|
add_header Cache-Control "no-cache, no-store, must-revalidate";
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
# 打到国内sit的agent.jar包
|
|||
|
|
location /sit-api/agent/ {
|
|||
|
|
proxy_pass http://106.53.194.199:8070;
|
|||
|
|
proxy_set_header Host 106.53.194.199;
|
|||
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|||
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|||
|
|
|
|||
|
|
proxy_intercept_errors off;
|
|||
|
|
proxy_buffering off;
|
|||
|
|
proxy_cache off;
|
|||
|
|
proxy_set_header Connection keep-alive;
|
|||
|
|
|
|||
|
|
client_max_body_size 300M;
|
|||
|
|
|
|||
|
|
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;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
location /sit-api/system {
|
|||
|
|
proxy_pass http://106.53.194.199:8070;
|
|||
|
|
proxy_set_header Host 106.53.199.199;
|
|||
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|||
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|||
|
|
|
|||
|
|
proxy_intercept_errors off;
|
|||
|
|
proxy_buffering off;
|
|||
|
|
proxy_cache off;
|
|||
|
|
proxy_set_header Connection keep-alive;
|
|||
|
|
|
|||
|
|
client_max_body_size 300M;
|
|||
|
|
|
|||
|
|
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;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
# 错误页面
|
|||
|
|
error_page 500 502 503 504 /50x.html;
|
|||
|
|
location = /50x.html {
|
|||
|
|
root /data/tengine/html/jennie-frontend/dist;
|
|||
|
|
}
|
|||
|
|
}
|