增加nginx代理,https域名
This commit is contained in:
@@ -75,7 +75,7 @@ services:
|
|||||||
depends_on:
|
depends_on:
|
||||||
- backend
|
- backend
|
||||||
environment:
|
environment:
|
||||||
VITE_API_BASE_URL: http://47.238.126.111:33001
|
VITE_API_BASE_URL: /api
|
||||||
VITE_API_URL: http://backend:3001
|
VITE_API_URL: http://backend:3001
|
||||||
ports:
|
ports:
|
||||||
- "2000:3000"
|
- "2000:3000"
|
||||||
@@ -91,6 +91,27 @@ services:
|
|||||||
retries: 3
|
retries: 3
|
||||||
start_period: 30s
|
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:
|
networks:
|
||||||
app-network:
|
app-network:
|
||||||
|
|||||||
94
nginx.conf
Normal file
94
nginx.conf
Normal file
@@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
1
tmpclaude-026f-cwd
Normal file
1
tmpclaude-026f-cwd
Normal file
@@ -0,0 +1 @@
|
|||||||
|
/c/Users/99095/Desktop/优一科技/performance-evaluation-system
|
||||||
1
tmpclaude-08b9-cwd
Normal file
1
tmpclaude-08b9-cwd
Normal file
@@ -0,0 +1 @@
|
|||||||
|
/c/Users/99095/Desktop/优一科技/performance-evaluation-system
|
||||||
1
tmpclaude-226f-cwd
Normal file
1
tmpclaude-226f-cwd
Normal file
@@ -0,0 +1 @@
|
|||||||
|
/c/Users/99095/Desktop/优一科技/performance-evaluation-system
|
||||||
1
tmpclaude-3e34-cwd
Normal file
1
tmpclaude-3e34-cwd
Normal file
@@ -0,0 +1 @@
|
|||||||
|
/c/Users/99095/Desktop/优一科技/performance-evaluation-system
|
||||||
1
tmpclaude-4f33-cwd
Normal file
1
tmpclaude-4f33-cwd
Normal file
@@ -0,0 +1 @@
|
|||||||
|
/c/Users/99095/Desktop/优一科技/performance-evaluation-system
|
||||||
1
tmpclaude-503c-cwd
Normal file
1
tmpclaude-503c-cwd
Normal file
@@ -0,0 +1 @@
|
|||||||
|
/c/Users/99095/Desktop/优一科技/performance-evaluation-system
|
||||||
1
tmpclaude-52cb-cwd
Normal file
1
tmpclaude-52cb-cwd
Normal file
@@ -0,0 +1 @@
|
|||||||
|
/c/Users/99095/Desktop/优一科技/performance-evaluation-system
|
||||||
1
tmpclaude-557d-cwd
Normal file
1
tmpclaude-557d-cwd
Normal file
@@ -0,0 +1 @@
|
|||||||
|
/c/Users/99095/Desktop/优一科技/performance-evaluation-system
|
||||||
1
tmpclaude-5a0d-cwd
Normal file
1
tmpclaude-5a0d-cwd
Normal file
@@ -0,0 +1 @@
|
|||||||
|
/c/Users/99095/Desktop/优一科技/performance-evaluation-system
|
||||||
1
tmpclaude-6d9a-cwd
Normal file
1
tmpclaude-6d9a-cwd
Normal file
@@ -0,0 +1 @@
|
|||||||
|
/c/Users/99095/Desktop/优一科技/performance-evaluation-system
|
||||||
1
tmpclaude-a420-cwd
Normal file
1
tmpclaude-a420-cwd
Normal file
@@ -0,0 +1 @@
|
|||||||
|
/c/Users/99095/Desktop/优一科技/performance-evaluation-system
|
||||||
1
tmpclaude-ade6-cwd
Normal file
1
tmpclaude-ade6-cwd
Normal file
@@ -0,0 +1 @@
|
|||||||
|
/c/Users/99095/Desktop/优一科技/performance-evaluation-system
|
||||||
1
tmpclaude-aef9-cwd
Normal file
1
tmpclaude-aef9-cwd
Normal file
@@ -0,0 +1 @@
|
|||||||
|
/c/Users/99095/Desktop/优一科技/performance-evaluation-system
|
||||||
1
tmpclaude-b3cf-cwd
Normal file
1
tmpclaude-b3cf-cwd
Normal file
@@ -0,0 +1 @@
|
|||||||
|
/c/Users/99095/Desktop/优一科技/performance-evaluation-system
|
||||||
1
tmpclaude-b61c-cwd
Normal file
1
tmpclaude-b61c-cwd
Normal file
@@ -0,0 +1 @@
|
|||||||
|
/c/Users/99095/Desktop/优一科技/performance-evaluation-system
|
||||||
1
tmpclaude-cbdd-cwd
Normal file
1
tmpclaude-cbdd-cwd
Normal file
@@ -0,0 +1 @@
|
|||||||
|
/c/Users/99095/Desktop/优一科技/performance-evaluation-system
|
||||||
1
tmpclaude-d3c2-cwd
Normal file
1
tmpclaude-d3c2-cwd
Normal file
@@ -0,0 +1 @@
|
|||||||
|
/c/Users/99095/Desktop/优一科技/performance-evaluation-system
|
||||||
1
tmpclaude-d3ec-cwd
Normal file
1
tmpclaude-d3ec-cwd
Normal file
@@ -0,0 +1 @@
|
|||||||
|
/c/Users/99095/Desktop/优一科技/performance-evaluation-system
|
||||||
1
tmpclaude-e66d-cwd
Normal file
1
tmpclaude-e66d-cwd
Normal file
@@ -0,0 +1 @@
|
|||||||
|
/c/Users/99095/Desktop/优一科技/performance-evaluation-system
|
||||||
1
tmpclaude-ed4b-cwd
Normal file
1
tmpclaude-ed4b-cwd
Normal file
@@ -0,0 +1 @@
|
|||||||
|
/c/Users/99095/Desktop/优一科技/performance-evaluation-system
|
||||||
1
tmpclaude-edac-cwd
Normal file
1
tmpclaude-edac-cwd
Normal file
@@ -0,0 +1 @@
|
|||||||
|
/c/Users/99095/Desktop/优一科技/performance-evaluation-system
|
||||||
1
tmpclaude-f1fe-cwd
Normal file
1
tmpclaude-f1fe-cwd
Normal file
@@ -0,0 +1 @@
|
|||||||
|
/c/Users/99095/Desktop/优一科技/performance-evaluation-system
|
||||||
Reference in New Issue
Block a user