docker初步构想

This commit is contained in:
2025-12-28 18:30:17 +08:00
parent 0beb631512
commit 154ac7f61c
2300 changed files with 8729 additions and 252 deletions

View File

@@ -0,0 +1,83 @@
# ================================================
# Urban Lifeline - 站点配置
# ================================================
# 上游服务定义
upstream gateway {
server gateway:8080;
keepalive 32;
}
upstream platform {
server platform:80;
}
upstream workcase-web {
server workcase-web:80;
}
server {
listen 80;
server_name localhost;
# 健康检查端点
location /health {
access_log off;
return 200 "healthy\n";
add_header Content-Type text/plain;
}
# ====================== 前端应用代理 ======================
# Platform 管理平台
location /platform/ {
proxy_pass http://platform/;
proxy_http_version 1.1;
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;
}
# Workcase 工单系统
location /workcase/ {
proxy_pass http://workcase-web/;
proxy_http_version 1.1;
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;
}
# 默认首页(重定向到 platform
location = / {
return 302 /platform/;
}
# ====================== API 代理 ======================
# 后端 API 代理
location /urban-lifeline/ {
proxy_pass http://gateway/urban-lifeline/;
proxy_http_version 1.1;
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;
# WebSocket 支持
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
# 超时设置
proxy_connect_timeout 60s;
proxy_send_timeout 60s;
proxy_read_timeout 60s;
}
# ====================== 错误页面 ======================
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}

View File

@@ -0,0 +1,47 @@
# ================================================
# Urban Lifeline - Nginx 主配置
# ================================================
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
use epoll;
multi_accept on;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
# 日志格式
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
# 性能优化
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
# Gzip 压缩
gzip on;
gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
gzip_types text/plain text/css text/xml application/json application/javascript
application/xml application/xml+rss text/javascript application/x-javascript;
# 上传文件大小限制
client_max_body_size 100M;
# 引入站点配置
include /etc/nginx/conf.d/*.conf;
}