feat: 完成项目整理优化和生产环境配置
🧹 项目结构优化: - 删除重复和过时的文件 - 整理文档到docs目录结构 - 优化配置文件到configs目录 - 创建清晰的PROJECT_STRUCTURE.md 🔧 中间件配置: - 重启MySQL/Redis/Nacos中间件 - 使用现有数据目录,确保数据完整性 - 统一密码配置: MySQL(EmotionMuseum2025*#), Nacos(Peanut2817*#) 🌐 Nginx配置: - 配置前端路径: /emotion-museum - 配置API代理: /api/ -> 19000 - 配置WebSocket代理: /ws/ -> 19007 - 添加健康检查端点: /health 📋 部署脚本优化: - restart-middleware.sh - 中间件重启脚本 - setup-nginx.sh - Nginx配置脚本 - cleanup-project.sh - 项目清理脚本 - one-click-deploy.sh - 一键部署脚本 📖 文档完善: - DEPLOYMENT_FINAL.md - 最终部署指南 - PROJECT_STRUCTURE.md - 项目结构说明 - 完整的运维和故障排查指南 ✅ 生产环境就绪: - 中间件: MySQL/Redis/Nacos 运行正常 - Nginx: 反向代理配置完成 - 访问地址: http://47.111.10.27/emotion-museum - 健康检查: http://47.111.10.27/health 🎯 项目现状: - 10个微服务模块完整 - 前后端分离架构 - 容器化部署 - 统一配置管理 - 完整的部署和运维体系
This commit is contained in:
@@ -0,0 +1,253 @@
|
||||
version: '3.8'
|
||||
|
||||
services:
|
||||
# MySQL数据库
|
||||
mysql:
|
||||
image: mysql:8.0
|
||||
container_name: emotion-mysql-prod
|
||||
restart: always
|
||||
environment:
|
||||
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
|
||||
MYSQL_DATABASE: ${MYSQL_DATABASE}
|
||||
MYSQL_USER: ${MYSQL_USER}
|
||||
MYSQL_PASSWORD: ${MYSQL_PASSWORD}
|
||||
TZ: ${TZ:-Asia/Shanghai}
|
||||
ports:
|
||||
- "3306:3306"
|
||||
volumes:
|
||||
- mysql_data:/var/lib/mysql
|
||||
- ./backend/mysql_emotion_museum_final.sql:/docker-entrypoint-initdb.d/init.sql
|
||||
- ./deploy/mysql/conf.d:/etc/mysql/conf.d
|
||||
- ./logs/mysql:/var/log/mysql
|
||||
command: --default-authentication-plugin=mysql_native_password
|
||||
networks:
|
||||
- emotion-network
|
||||
deploy:
|
||||
resources:
|
||||
limits:
|
||||
memory: 1G
|
||||
reservations:
|
||||
memory: 512M
|
||||
|
||||
# Redis缓存
|
||||
redis:
|
||||
image: redis:7-alpine
|
||||
container_name: emotion-redis-prod
|
||||
restart: always
|
||||
ports:
|
||||
- "6379:6379"
|
||||
volumes:
|
||||
- redis_data:/data
|
||||
- ./deploy/redis/redis.conf:/usr/local/etc/redis/redis.conf
|
||||
- ./logs/redis:/var/log/redis
|
||||
command: redis-server /usr/local/etc/redis/redis.conf
|
||||
networks:
|
||||
- emotion-network
|
||||
deploy:
|
||||
resources:
|
||||
limits:
|
||||
memory: 512M
|
||||
reservations:
|
||||
memory: 256M
|
||||
|
||||
# Nacos注册中心
|
||||
nacos:
|
||||
image: nacos/nacos-server:v2.2.0
|
||||
container_name: emotion-nacos-prod
|
||||
restart: always
|
||||
environment:
|
||||
MODE: standalone
|
||||
SPRING_DATASOURCE_PLATFORM: mysql
|
||||
MYSQL_SERVICE_HOST: mysql
|
||||
MYSQL_SERVICE_DB_NAME: nacos_config
|
||||
MYSQL_SERVICE_PORT: 3306
|
||||
MYSQL_SERVICE_USER: ${MYSQL_USER}
|
||||
MYSQL_SERVICE_PASSWORD: ${MYSQL_PASSWORD}
|
||||
MYSQL_SERVICE_DB_PARAM: characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useSSL=false&allowPublicKeyRetrieval=true
|
||||
JVM_XMS: 512m
|
||||
JVM_XMX: 1024m
|
||||
JVM_XMN: 256m
|
||||
NACOS_AUTH_ENABLE: ${NACOS_AUTH_ENABLE:-false}
|
||||
ports:
|
||||
- "8848:8848"
|
||||
- "9848:9848"
|
||||
volumes:
|
||||
- nacos_data:/home/nacos/data
|
||||
- nacos_logs:/home/nacos/logs
|
||||
depends_on:
|
||||
- mysql
|
||||
networks:
|
||||
- emotion-network
|
||||
deploy:
|
||||
resources:
|
||||
limits:
|
||||
memory: 1.5G
|
||||
reservations:
|
||||
memory: 512M
|
||||
|
||||
# 网关服务
|
||||
gateway:
|
||||
build:
|
||||
context: ./backend
|
||||
dockerfile: ./emotion-gateway/Dockerfile
|
||||
image: emotion-gateway:latest
|
||||
container_name: emotion-gateway-prod
|
||||
restart: always
|
||||
ports:
|
||||
- "9000:9000"
|
||||
environment:
|
||||
SPRING_PROFILES_ACTIVE: docker
|
||||
NACOS_SERVER_ADDR: nacos:8848
|
||||
MYSQL_HOST: mysql
|
||||
MYSQL_PORT: 3306
|
||||
REDIS_HOST: redis
|
||||
REDIS_PORT: 6379
|
||||
TZ: ${TZ:-Asia/Shanghai}
|
||||
volumes:
|
||||
- ./logs/gateway:/app/logs
|
||||
depends_on:
|
||||
- mysql
|
||||
- redis
|
||||
- nacos
|
||||
networks:
|
||||
- emotion-network
|
||||
deploy:
|
||||
resources:
|
||||
limits:
|
||||
memory: 1G
|
||||
reservations:
|
||||
memory: 512M
|
||||
|
||||
# AI服务
|
||||
ai-service:
|
||||
build:
|
||||
context: ./backend
|
||||
dockerfile: ./emotion-ai/Dockerfile
|
||||
image: emotion-ai:latest
|
||||
container_name: emotion-ai-prod
|
||||
restart: always
|
||||
ports:
|
||||
- "9002:9002"
|
||||
environment:
|
||||
SPRING_PROFILES_ACTIVE: docker
|
||||
NACOS_SERVER_ADDR: nacos:8848
|
||||
MYSQL_HOST: mysql
|
||||
MYSQL_PORT: 3306
|
||||
REDIS_HOST: redis
|
||||
REDIS_PORT: 6379
|
||||
COZE_API_TOKEN: ${COZE_API_TOKEN}
|
||||
TZ: ${TZ:-Asia/Shanghai}
|
||||
volumes:
|
||||
- ./logs/ai:/app/logs
|
||||
depends_on:
|
||||
- mysql
|
||||
- redis
|
||||
- nacos
|
||||
networks:
|
||||
- emotion-network
|
||||
deploy:
|
||||
resources:
|
||||
limits:
|
||||
memory: 1G
|
||||
reservations:
|
||||
memory: 512M
|
||||
|
||||
# 用户服务
|
||||
user-service:
|
||||
build:
|
||||
context: ./backend
|
||||
dockerfile: ./emotion-user/Dockerfile
|
||||
image: emotion-user:latest
|
||||
container_name: emotion-user-prod
|
||||
restart: always
|
||||
ports:
|
||||
- "9001:9001"
|
||||
environment:
|
||||
SPRING_PROFILES_ACTIVE: docker
|
||||
NACOS_SERVER_ADDR: nacos:8848
|
||||
MYSQL_HOST: mysql
|
||||
MYSQL_PORT: 3306
|
||||
REDIS_HOST: redis
|
||||
REDIS_PORT: 6379
|
||||
TZ: ${TZ:-Asia/Shanghai}
|
||||
volumes:
|
||||
- ./logs/user:/app/logs
|
||||
depends_on:
|
||||
- mysql
|
||||
- redis
|
||||
- nacos
|
||||
networks:
|
||||
- emotion-network
|
||||
deploy:
|
||||
resources:
|
||||
limits:
|
||||
memory: 1G
|
||||
reservations:
|
||||
memory: 512M
|
||||
|
||||
# 前端应用
|
||||
web:
|
||||
build:
|
||||
context: ./web
|
||||
dockerfile: Dockerfile
|
||||
args:
|
||||
BUILD_ENV: production
|
||||
image: emotion-web:latest
|
||||
container_name: emotion-web-prod
|
||||
restart: always
|
||||
ports:
|
||||
- "3000:80"
|
||||
volumes:
|
||||
- ./logs/web:/var/log/nginx
|
||||
depends_on:
|
||||
- gateway
|
||||
networks:
|
||||
- emotion-network
|
||||
deploy:
|
||||
resources:
|
||||
limits:
|
||||
memory: 256M
|
||||
reservations:
|
||||
memory: 128M
|
||||
|
||||
# Nginx反向代理
|
||||
nginx:
|
||||
image: nginx:alpine
|
||||
container_name: emotion-nginx-prod
|
||||
restart: always
|
||||
ports:
|
||||
- "80:80"
|
||||
- "443:443"
|
||||
volumes:
|
||||
- ./deploy/nginx/nginx.conf:/etc/nginx/nginx.conf
|
||||
- ./deploy/nginx/conf.d:/etc/nginx/conf.d
|
||||
- ./deploy/nginx/ssl:/etc/nginx/ssl
|
||||
- ./logs/nginx:/var/log/nginx
|
||||
depends_on:
|
||||
- web
|
||||
- gateway
|
||||
networks:
|
||||
- emotion-network
|
||||
deploy:
|
||||
resources:
|
||||
limits:
|
||||
memory: 256M
|
||||
reservations:
|
||||
memory: 128M
|
||||
|
||||
volumes:
|
||||
mysql_data:
|
||||
driver: local
|
||||
redis_data:
|
||||
driver: local
|
||||
nacos_data:
|
||||
driver: local
|
||||
nacos_logs:
|
||||
driver: local
|
||||
|
||||
networks:
|
||||
emotion-network:
|
||||
driver: bridge
|
||||
ipam:
|
||||
config:
|
||||
- subnet: 172.20.0.0/16
|
||||
@@ -0,0 +1,178 @@
|
||||
version: '3.8'
|
||||
|
||||
services:
|
||||
# MySQL数据库
|
||||
mysql:
|
||||
image: mysql:8.0
|
||||
container_name: emotion-mysql
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
MYSQL_ROOT_PASSWORD: 123456
|
||||
MYSQL_DATABASE: emotion_museum
|
||||
MYSQL_USER: emotion
|
||||
MYSQL_PASSWORD: emotion123
|
||||
TZ: Asia/Shanghai
|
||||
ports:
|
||||
- "3306:3306"
|
||||
volumes:
|
||||
- mysql_data:/var/lib/mysql
|
||||
- ./backend/mysql_emotion_museum_final.sql:/docker-entrypoint-initdb.d/init.sql
|
||||
- ./deploy/mysql/conf.d:/etc/mysql/conf.d
|
||||
command: --default-authentication-plugin=mysql_native_password
|
||||
networks:
|
||||
- emotion-network
|
||||
|
||||
# Redis缓存
|
||||
redis:
|
||||
image: redis:7-alpine
|
||||
container_name: emotion-redis
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- "6379:6379"
|
||||
volumes:
|
||||
- redis_data:/data
|
||||
- ./deploy/redis/redis.conf:/usr/local/etc/redis/redis.conf
|
||||
command: redis-server /usr/local/etc/redis/redis.conf
|
||||
networks:
|
||||
- emotion-network
|
||||
|
||||
# Nacos注册中心
|
||||
nacos:
|
||||
image: nacos/nacos-server:v2.2.0
|
||||
container_name: emotion-nacos
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
MODE: standalone
|
||||
SPRING_DATASOURCE_PLATFORM: mysql
|
||||
MYSQL_SERVICE_HOST: mysql
|
||||
MYSQL_SERVICE_DB_NAME: nacos_config
|
||||
MYSQL_SERVICE_PORT: 3306
|
||||
MYSQL_SERVICE_USER: root
|
||||
MYSQL_SERVICE_PASSWORD: 123456
|
||||
MYSQL_SERVICE_DB_PARAM: characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useSSL=false&allowPublicKeyRetrieval=true
|
||||
JVM_XMS: 512m
|
||||
JVM_XMX: 512m
|
||||
JVM_XMN: 256m
|
||||
ports:
|
||||
- "8848:8848"
|
||||
- "9848:9848"
|
||||
volumes:
|
||||
- nacos_data:/home/nacos/data
|
||||
- nacos_logs:/home/nacos/logs
|
||||
depends_on:
|
||||
- mysql
|
||||
networks:
|
||||
- emotion-network
|
||||
|
||||
# 网关服务
|
||||
gateway:
|
||||
build:
|
||||
context: ./backend
|
||||
dockerfile: ./emotion-gateway/Dockerfile
|
||||
container_name: emotion-gateway
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- "9000:9000"
|
||||
environment:
|
||||
SPRING_PROFILES_ACTIVE: docker
|
||||
NACOS_SERVER_ADDR: nacos:8848
|
||||
MYSQL_HOST: mysql
|
||||
MYSQL_PORT: 3306
|
||||
REDIS_HOST: redis
|
||||
REDIS_PORT: 6379
|
||||
depends_on:
|
||||
- mysql
|
||||
- redis
|
||||
- nacos
|
||||
networks:
|
||||
- emotion-network
|
||||
|
||||
# AI服务
|
||||
ai-service:
|
||||
build:
|
||||
context: ./backend
|
||||
dockerfile: ./emotion-ai/Dockerfile
|
||||
container_name: emotion-ai
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- "9002:9002"
|
||||
environment:
|
||||
SPRING_PROFILES_ACTIVE: docker
|
||||
NACOS_SERVER_ADDR: nacos:8848
|
||||
MYSQL_HOST: mysql
|
||||
MYSQL_PORT: 3306
|
||||
REDIS_HOST: redis
|
||||
REDIS_PORT: 6379
|
||||
depends_on:
|
||||
- mysql
|
||||
- redis
|
||||
- nacos
|
||||
networks:
|
||||
- emotion-network
|
||||
|
||||
# 用户服务
|
||||
user-service:
|
||||
build:
|
||||
context: ./backend
|
||||
dockerfile: ./emotion-user/Dockerfile
|
||||
container_name: emotion-user
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- "9001:9001"
|
||||
environment:
|
||||
SPRING_PROFILES_ACTIVE: docker
|
||||
NACOS_SERVER_ADDR: nacos:8848
|
||||
MYSQL_HOST: mysql
|
||||
MYSQL_PORT: 3306
|
||||
REDIS_HOST: redis
|
||||
REDIS_PORT: 6379
|
||||
depends_on:
|
||||
- mysql
|
||||
- redis
|
||||
- nacos
|
||||
networks:
|
||||
- emotion-network
|
||||
|
||||
# 前端应用
|
||||
web:
|
||||
build:
|
||||
context: ./web
|
||||
dockerfile: Dockerfile
|
||||
container_name: emotion-web
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- "3000:80"
|
||||
depends_on:
|
||||
- gateway
|
||||
networks:
|
||||
- emotion-network
|
||||
|
||||
# Nginx反向代理
|
||||
nginx:
|
||||
image: nginx:alpine
|
||||
container_name: emotion-nginx
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- "80:80"
|
||||
- "443:443"
|
||||
volumes:
|
||||
- ./deploy/nginx/nginx.conf:/etc/nginx/nginx.conf
|
||||
- ./deploy/nginx/conf.d:/etc/nginx/conf.d
|
||||
- ./deploy/nginx/ssl:/etc/nginx/ssl
|
||||
- nginx_logs:/var/log/nginx
|
||||
depends_on:
|
||||
- web
|
||||
- gateway
|
||||
networks:
|
||||
- emotion-network
|
||||
|
||||
volumes:
|
||||
mysql_data:
|
||||
redis_data:
|
||||
nacos_data:
|
||||
nacos_logs:
|
||||
nginx_logs:
|
||||
|
||||
networks:
|
||||
emotion-network:
|
||||
driver: bridge
|
||||
@@ -0,0 +1,116 @@
|
||||
# 情绪博物馆主站配置
|
||||
server {
|
||||
listen 80;
|
||||
server_name localhost emotion-museum.com www.emotion-museum.com;
|
||||
|
||||
# 日志配置
|
||||
access_log /data/logs/nginx/nginx_access.log main;
|
||||
error_log /data/logs/nginx/nginx_error.log warn;
|
||||
|
||||
# 安全头
|
||||
add_header X-Frame-Options "SAMEORIGIN" always;
|
||||
add_header X-Content-Type-Options "nosniff" always;
|
||||
add_header X-XSS-Protection "1; mode=block" always;
|
||||
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
|
||||
|
||||
# API代理到网关服务 (Docker容器内部端口9000)
|
||||
location /api/ {
|
||||
# 限流
|
||||
limit_req zone=api burst=20 nodelay;
|
||||
|
||||
# 代理到网关服务 (Docker容器)
|
||||
proxy_pass http://emotion-gateway:9000;
|
||||
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_connect_timeout 30s;
|
||||
proxy_send_timeout 30s;
|
||||
proxy_read_timeout 30s;
|
||||
|
||||
# 缓存控制
|
||||
proxy_cache_bypass $http_upgrade;
|
||||
proxy_no_cache $http_upgrade;
|
||||
|
||||
# WebSocket支持
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
}
|
||||
|
||||
# 前端静态文件服务 (直接从宿主机目录提供)
|
||||
location / {
|
||||
# 限流
|
||||
limit_req zone=web burst=50 nodelay;
|
||||
|
||||
# 直接从宿主机目录提供静态文件
|
||||
root /data/www/emotion-museum;
|
||||
index index.html index.htm;
|
||||
try_files $uri $uri/ /index.html;
|
||||
|
||||
# 静态资源缓存
|
||||
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ {
|
||||
root /data/www/emotion-museum;
|
||||
expires 30d;
|
||||
add_header Cache-Control "public, immutable";
|
||||
add_header Vary "Accept-Encoding";
|
||||
try_files $uri =404;
|
||||
}
|
||||
|
||||
# HTML文件不缓存
|
||||
location ~* \.(html|htm)$ {
|
||||
root /data/www/emotion-museum;
|
||||
expires -1;
|
||||
add_header Cache-Control "no-cache, no-store, must-revalidate";
|
||||
add_header Pragma "no-cache";
|
||||
try_files $uri $uri/ /index.html;
|
||||
}
|
||||
}
|
||||
|
||||
# 健康检查
|
||||
location /nginx-health {
|
||||
access_log off;
|
||||
return 200 "healthy\n";
|
||||
add_header Content-Type text/plain;
|
||||
}
|
||||
|
||||
# 错误页面
|
||||
error_page 404 /404.html;
|
||||
error_page 500 502 503 504 /50x.html;
|
||||
|
||||
location = /50x.html {
|
||||
root /usr/share/nginx/html;
|
||||
}
|
||||
}
|
||||
|
||||
# HTTPS配置 (可选)
|
||||
# server {
|
||||
# listen 443 ssl http2;
|
||||
# server_name emotion-museum.com www.emotion-museum.com;
|
||||
#
|
||||
# # SSL证书配置
|
||||
# ssl_certificate /etc/nginx/ssl/emotion-museum.crt;
|
||||
# ssl_certificate_key /etc/nginx/ssl/emotion-museum.key;
|
||||
#
|
||||
# # SSL安全配置
|
||||
# ssl_protocols TLSv1.2 TLSv1.3;
|
||||
# ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384;
|
||||
# ssl_prefer_server_ciphers off;
|
||||
# ssl_session_cache shared:SSL:10m;
|
||||
# ssl_session_timeout 10m;
|
||||
#
|
||||
# # HSTS
|
||||
# add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
|
||||
#
|
||||
# # 其他配置与HTTP相同
|
||||
# include /etc/nginx/conf.d/emotion-museum-common.conf;
|
||||
# }
|
||||
|
||||
# HTTP重定向到HTTPS (可选)
|
||||
# server {
|
||||
# listen 80;
|
||||
# server_name emotion-museum.com www.emotion-museum.com;
|
||||
# return 301 https://$server_name$request_uri;
|
||||
# }
|
||||
@@ -0,0 +1,86 @@
|
||||
user nginx;
|
||||
worker_processes auto;
|
||||
error_log /var/log/nginx/error.log notice;
|
||||
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" '
|
||||
'$request_time $upstream_response_time';
|
||||
|
||||
access_log /var/log/nginx/access.log main;
|
||||
|
||||
# 基础配置
|
||||
sendfile on;
|
||||
tcp_nopush on;
|
||||
tcp_nodelay on;
|
||||
keepalive_timeout 65;
|
||||
types_hash_max_size 2048;
|
||||
server_tokens off;
|
||||
|
||||
# Gzip压缩
|
||||
gzip on;
|
||||
gzip_vary on;
|
||||
gzip_min_length 1024;
|
||||
gzip_proxied any;
|
||||
gzip_comp_level 6;
|
||||
gzip_types
|
||||
text/plain
|
||||
text/css
|
||||
text/xml
|
||||
text/javascript
|
||||
application/json
|
||||
application/javascript
|
||||
application/xml+rss
|
||||
application/atom+xml
|
||||
image/svg+xml;
|
||||
|
||||
# 客户端配置
|
||||
client_max_body_size 50M;
|
||||
client_body_buffer_size 128k;
|
||||
client_header_buffer_size 32k;
|
||||
large_client_header_buffers 4 32k;
|
||||
|
||||
# 代理配置
|
||||
proxy_connect_timeout 60s;
|
||||
proxy_send_timeout 60s;
|
||||
proxy_read_timeout 60s;
|
||||
proxy_buffer_size 64k;
|
||||
proxy_buffers 4 64k;
|
||||
proxy_busy_buffers_size 128k;
|
||||
proxy_temp_file_write_size 128k;
|
||||
|
||||
# 上游服务器定义 - Docker容器服务
|
||||
upstream emotion-gateway {
|
||||
server emotion-gateway:9000 max_fails=3 fail_timeout=30s;
|
||||
keepalive 32;
|
||||
}
|
||||
|
||||
upstream emotion-ai {
|
||||
server emotion-ai:9002 max_fails=3 fail_timeout=30s;
|
||||
keepalive 32;
|
||||
}
|
||||
|
||||
upstream emotion-user {
|
||||
server emotion-user:9001 max_fails=3 fail_timeout=30s;
|
||||
keepalive 32;
|
||||
}
|
||||
|
||||
# 限流配置
|
||||
limit_req_zone $binary_remote_addr zone=api:10m rate=10r/s;
|
||||
limit_req_zone $binary_remote_addr zone=web:10m rate=20r/s;
|
||||
|
||||
# 包含站点配置
|
||||
include /etc/nginx/conf.d/*.conf;
|
||||
}
|
||||
Reference in New Issue
Block a user