diff --git a/docker-compose.yml b/docker-compose.yml index 068e289..715bd7d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -75,7 +75,7 @@ services: depends_on: - backend environment: - VITE_API_BASE_URL: http://47.238.126.111:33001 + VITE_API_BASE_URL: /api VITE_API_URL: http://backend:3001 ports: - "2000:3000" @@ -91,6 +91,27 @@ services: retries: 3 start_period: 30s + # Nginx反向代理服务 + nginx: + image: nginx:alpine + container_name: performance-nginx + restart: unless-stopped + depends_on: + - frontend + - backend + ports: + - "80:80" + volumes: + - ./nginx.conf:/etc/nginx/nginx.conf:ro + networks: + - app-network + healthcheck: + test: ["CMD", "nginx", "-t"] + interval: 30s + timeout: 5s + retries: 3 + start_period: 10s + # 定义网络 networks: app-network: diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 0000000..c423b39 --- /dev/null +++ b/nginx.conf @@ -0,0 +1,94 @@ +# Nginx configuration for performance appraisal system +# This file will be mounted into nginx container + +events { + worker_connections 1024; +} + +http { + include mime.types; + default_type application/octet-stream; + + # Logging + 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; + error_log /var/log/nginx/error.log warn; + + # Gzip compression + gzip on; + gzip_vary on; + gzip_min_length 1024; + gzip_types text/plain text/css text/xml text/javascript application/javascript application/xml+rss application/json; + + # Real IP configuration for proxy (ESA HTTPS proxy) + real_ip_header X-Forwarded-For; + set_real_ip_from 0.0.0.0/0; # Trust all proxies (adjust if you know ESA proxy IPs) + + # Server block for domain + server { + listen 80; + server_name performance-appraisal.excn.top; + + # Redirect to HTTPS if request came via HTTP (not from ESA proxy) + if ($http_x_forwarded_proto = "http") { + return 301 https://$server_name$request_uri; + } + + # Frontend React development server (via Docker network) + location / { + proxy_pass http://frontend:3000; + 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 $http_x_forwarded_proto; + + # WebSocket support for hot reload (development) + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "upgrade"; + } + + # Backend API reverse proxy + location /api/ { + proxy_pass http://backend:3001/; + 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 $http_x_forwarded_proto; + + # Increase timeout for long-running AI requests + proxy_read_timeout 120s; + proxy_connect_timeout 15s; + proxy_send_timeout 15s; + } + + # Static assets (if any) + location /assets/ { + proxy_pass http://frontend:3000/assets/; + 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 $http_x_forwarded_proto; + + # Cache static assets + expires 30d; + add_header Cache-Control "public, immutable"; + } + + # Health check endpoint + location /health { + access_log off; + return 200 "healthy\n"; + add_header Content-Type text/plain; + } + } + + # Optional: Redirect www to non-www + server { + listen 80; + server_name www.performance-appraisal.excn.top; + return 301 https://performance-appraisal.excn.top$request_uri; + } +} \ No newline at end of file diff --git a/tmpclaude-026f-cwd b/tmpclaude-026f-cwd new file mode 100644 index 0000000..0a8904c --- /dev/null +++ b/tmpclaude-026f-cwd @@ -0,0 +1 @@ +/c/Users/99095/Desktop/优一科技/performance-evaluation-system diff --git a/tmpclaude-08b9-cwd b/tmpclaude-08b9-cwd new file mode 100644 index 0000000..0a8904c --- /dev/null +++ b/tmpclaude-08b9-cwd @@ -0,0 +1 @@ +/c/Users/99095/Desktop/优一科技/performance-evaluation-system diff --git a/tmpclaude-226f-cwd b/tmpclaude-226f-cwd new file mode 100644 index 0000000..0a8904c --- /dev/null +++ b/tmpclaude-226f-cwd @@ -0,0 +1 @@ +/c/Users/99095/Desktop/优一科技/performance-evaluation-system diff --git a/tmpclaude-3e34-cwd b/tmpclaude-3e34-cwd new file mode 100644 index 0000000..0a8904c --- /dev/null +++ b/tmpclaude-3e34-cwd @@ -0,0 +1 @@ +/c/Users/99095/Desktop/优一科技/performance-evaluation-system diff --git a/tmpclaude-4f33-cwd b/tmpclaude-4f33-cwd new file mode 100644 index 0000000..0a8904c --- /dev/null +++ b/tmpclaude-4f33-cwd @@ -0,0 +1 @@ +/c/Users/99095/Desktop/优一科技/performance-evaluation-system diff --git a/tmpclaude-503c-cwd b/tmpclaude-503c-cwd new file mode 100644 index 0000000..0a8904c --- /dev/null +++ b/tmpclaude-503c-cwd @@ -0,0 +1 @@ +/c/Users/99095/Desktop/优一科技/performance-evaluation-system diff --git a/tmpclaude-52cb-cwd b/tmpclaude-52cb-cwd new file mode 100644 index 0000000..0a8904c --- /dev/null +++ b/tmpclaude-52cb-cwd @@ -0,0 +1 @@ +/c/Users/99095/Desktop/优一科技/performance-evaluation-system diff --git a/tmpclaude-557d-cwd b/tmpclaude-557d-cwd new file mode 100644 index 0000000..0a8904c --- /dev/null +++ b/tmpclaude-557d-cwd @@ -0,0 +1 @@ +/c/Users/99095/Desktop/优一科技/performance-evaluation-system diff --git a/tmpclaude-5a0d-cwd b/tmpclaude-5a0d-cwd new file mode 100644 index 0000000..0a8904c --- /dev/null +++ b/tmpclaude-5a0d-cwd @@ -0,0 +1 @@ +/c/Users/99095/Desktop/优一科技/performance-evaluation-system diff --git a/tmpclaude-6d9a-cwd b/tmpclaude-6d9a-cwd new file mode 100644 index 0000000..0a8904c --- /dev/null +++ b/tmpclaude-6d9a-cwd @@ -0,0 +1 @@ +/c/Users/99095/Desktop/优一科技/performance-evaluation-system diff --git a/tmpclaude-a420-cwd b/tmpclaude-a420-cwd new file mode 100644 index 0000000..0a8904c --- /dev/null +++ b/tmpclaude-a420-cwd @@ -0,0 +1 @@ +/c/Users/99095/Desktop/优一科技/performance-evaluation-system diff --git a/tmpclaude-ade6-cwd b/tmpclaude-ade6-cwd new file mode 100644 index 0000000..0a8904c --- /dev/null +++ b/tmpclaude-ade6-cwd @@ -0,0 +1 @@ +/c/Users/99095/Desktop/优一科技/performance-evaluation-system diff --git a/tmpclaude-aef9-cwd b/tmpclaude-aef9-cwd new file mode 100644 index 0000000..0a8904c --- /dev/null +++ b/tmpclaude-aef9-cwd @@ -0,0 +1 @@ +/c/Users/99095/Desktop/优一科技/performance-evaluation-system diff --git a/tmpclaude-b3cf-cwd b/tmpclaude-b3cf-cwd new file mode 100644 index 0000000..0a8904c --- /dev/null +++ b/tmpclaude-b3cf-cwd @@ -0,0 +1 @@ +/c/Users/99095/Desktop/优一科技/performance-evaluation-system diff --git a/tmpclaude-b61c-cwd b/tmpclaude-b61c-cwd new file mode 100644 index 0000000..0a8904c --- /dev/null +++ b/tmpclaude-b61c-cwd @@ -0,0 +1 @@ +/c/Users/99095/Desktop/优一科技/performance-evaluation-system diff --git a/tmpclaude-cbdd-cwd b/tmpclaude-cbdd-cwd new file mode 100644 index 0000000..0a8904c --- /dev/null +++ b/tmpclaude-cbdd-cwd @@ -0,0 +1 @@ +/c/Users/99095/Desktop/优一科技/performance-evaluation-system diff --git a/tmpclaude-d3c2-cwd b/tmpclaude-d3c2-cwd new file mode 100644 index 0000000..0a8904c --- /dev/null +++ b/tmpclaude-d3c2-cwd @@ -0,0 +1 @@ +/c/Users/99095/Desktop/优一科技/performance-evaluation-system diff --git a/tmpclaude-d3ec-cwd b/tmpclaude-d3ec-cwd new file mode 100644 index 0000000..0a8904c --- /dev/null +++ b/tmpclaude-d3ec-cwd @@ -0,0 +1 @@ +/c/Users/99095/Desktop/优一科技/performance-evaluation-system diff --git a/tmpclaude-e66d-cwd b/tmpclaude-e66d-cwd new file mode 100644 index 0000000..0a8904c --- /dev/null +++ b/tmpclaude-e66d-cwd @@ -0,0 +1 @@ +/c/Users/99095/Desktop/优一科技/performance-evaluation-system diff --git a/tmpclaude-ed4b-cwd b/tmpclaude-ed4b-cwd new file mode 100644 index 0000000..0a8904c --- /dev/null +++ b/tmpclaude-ed4b-cwd @@ -0,0 +1 @@ +/c/Users/99095/Desktop/优一科技/performance-evaluation-system diff --git a/tmpclaude-edac-cwd b/tmpclaude-edac-cwd new file mode 100644 index 0000000..0a8904c --- /dev/null +++ b/tmpclaude-edac-cwd @@ -0,0 +1 @@ +/c/Users/99095/Desktop/优一科技/performance-evaluation-system diff --git a/tmpclaude-f1fe-cwd b/tmpclaude-f1fe-cwd new file mode 100644 index 0000000..0a8904c --- /dev/null +++ b/tmpclaude-f1fe-cwd @@ -0,0 +1 @@ +/c/Users/99095/Desktop/优一科技/performance-evaluation-system