92 lines
3.0 KiB
Nginx Configuration File
92 lines
3.0 KiB
Nginx Configuration File
worker_processes 1;
|
|
|
|
events {
|
|
worker_connections 1024;
|
|
}
|
|
|
|
http {
|
|
include mime.types; # 引入 MIME 类型
|
|
default_type application/octet-stream; # 默认 MIME 类型
|
|
|
|
server {
|
|
listen 80;
|
|
server_name erp.benshutech.com;
|
|
|
|
# 设置 Vue 应用的静态文件路径
|
|
root /usr/share/nginx/html;
|
|
index index.html;
|
|
|
|
# 默认 location 配置
|
|
location / {
|
|
try_files $uri $uri/ /index.html;
|
|
}
|
|
|
|
# 处理 /prod-api/ 的代理请求
|
|
location /prod-api/ {
|
|
proxy_set_header Host $http_host;
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
proxy_set_header REMOTE-HOST $remote_addr;
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
# --- 新增 SSE 关键配置 ---
|
|
proxy_http_version 1.1; # 必须使用 HTTP/1.1
|
|
proxy_buffering off; # 关闭缓冲,确保数据实时发送
|
|
proxy_read_timeout 1800s; # 增加读取超时时间 (例如 30 分钟)
|
|
proxy_send_timeout 1800s; # 增加发送超时时间 (例如 30 分钟)
|
|
proxy_connect_timeout 60s; # 连接超时时间
|
|
# --- 结束新增 ---
|
|
|
|
#proxy_pass http://10.0.2.22:8088/;
|
|
proxy_pass http://172.17.62.227:8088/;
|
|
}
|
|
|
|
}
|
|
|
|
server {
|
|
listen 443 ssl;
|
|
server_name erp.benshutech.com;
|
|
|
|
#charset koi8-r;
|
|
|
|
#access_log logs/host.access.log main;/opt/cert
|
|
|
|
ssl_certificate /etc/nginx/cert/benshutech.com.pem;
|
|
ssl_certificate_key /etc/nginx/cert/benshutech.com.key;
|
|
ssl_session_timeout 5m;
|
|
ssl_ciphers HIGH:!aNULL:!MD5;
|
|
ssl_prefer_server_ciphers on;
|
|
|
|
location / {
|
|
root /usr/share/nginx/html;
|
|
index index.html index.htm;
|
|
try_files $uri $uri/ /index.html;
|
|
}
|
|
|
|
# 处理 /prod-api/ 的代理请求
|
|
location /prod-api/ {
|
|
proxy_set_header Host $http_host;
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
proxy_set_header REMOTE-HOST $remote_addr;
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
# --- 新增 SSE 关键配置 ---
|
|
proxy_http_version 1.1; # 必须使用 HTTP/1.1
|
|
proxy_buffering off; # 关闭缓冲,确保数据实时发送
|
|
proxy_read_timeout 1800s; # 增加读取超时时间 (例如 30 分钟)
|
|
proxy_send_timeout 1800s; # 增加发送超时时间 (例如 30 分钟)
|
|
proxy_connect_timeout 60s; # 连接超时时间
|
|
# --- 结束新增 ---
|
|
proxy_pass http://172.17.62.227:8088/;
|
|
}
|
|
|
|
#error_page 404 /404.html;
|
|
|
|
# redirect server error pages to the static page /50x.html
|
|
#
|
|
error_page 500 502 503 504 /50x.html;
|
|
location = /50x.html {
|
|
root html;
|
|
}
|
|
|
|
}
|
|
}
|
|
|