feat: 完成容器化系统和用户文档开发
本次提交包含3个重要功能的完成: 1. 📖 用户使用文档完成 - 创建完整的用户使用手册 (docs/USER_MANUAL.md) - 管理后台使用指南 (登录、照片管理、分类管理) - 前端网站使用说明 (浏览、搜索、移动端) - 部署运维指南 (环境准备、监控维护) - 故障排查指南 (错误处理、性能优化) - 技术支持体系和问题反馈渠道 2. 🐳 后端Docker容器化完成 - 多阶段构建Dockerfile (golang:1.23-alpine → scratch) - Docker Compose开发环境 (PostgreSQL + Redis + API) - 优化的构建配置和安全用户设置 - 健康检查和环境变量管理 - 更新Makefile添加Docker命令 3. 🏗️ 前端Docker容器化完成 - 多阶段构建Dockerfile (node:20-alpine → nginx:1.25-alpine) - 集成bun包管理器优化构建速度 - 优化的Nginx配置 (缓存、压缩、安全头部) - Docker Compose多模式支持 (开发/生产/代理) - 更新Makefile添加Docker命令 4. 📋 完整的Docker编排系统 - 项目根目录完整的docker-compose.yml - 支持数据库、缓存、API、前端、管理后台的统一部署 - 自动化Docker设置脚本 (docker-setup.sh) - 生产环境监控和日志收集配置 技术成果: - 项目完成率从65.0%提升至72.5% - 中优先级任务完成率达90% - 低优先级任务开始推进(18%) - 容器化部署体系完全就绪 - 用户文档体系建立完成 下一步: 继续推进容器化扩展和性能优化任务
This commit is contained in:
85
frontend/default.conf
Normal file
85
frontend/default.conf
Normal file
@ -0,0 +1,85 @@
|
||||
# Photography Portfolio Frontend - Default Site Configuration
|
||||
# 静态文件服务和缓存策略
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
server_name localhost;
|
||||
root /usr/share/nginx/html;
|
||||
index index.html;
|
||||
|
||||
# 安全配置
|
||||
add_header X-Frame-Options "SAMEORIGIN" always;
|
||||
add_header X-XSS-Protection "1; mode=block" always;
|
||||
add_header X-Content-Type-Options "nosniff" always;
|
||||
add_header Referrer-Policy "no-referrer-when-downgrade" always;
|
||||
|
||||
# 主页面路由
|
||||
location / {
|
||||
try_files $uri $uri/ /index.html;
|
||||
|
||||
# 缓存策略 - HTML文件不缓存
|
||||
add_header Cache-Control "no-cache, no-store, must-revalidate";
|
||||
add_header Pragma "no-cache";
|
||||
add_header Expires "0";
|
||||
}
|
||||
|
||||
# 静态资源缓存策略
|
||||
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ {
|
||||
expires 1y;
|
||||
add_header Cache-Control "public, immutable";
|
||||
add_header Vary "Accept-Encoding";
|
||||
|
||||
# 跨域配置
|
||||
add_header Access-Control-Allow-Origin "*";
|
||||
add_header Access-Control-Allow-Methods "GET, POST, OPTIONS";
|
||||
add_header Access-Control-Allow-Headers "DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range";
|
||||
}
|
||||
|
||||
# Next.js 静态文件
|
||||
location /_next/static/ {
|
||||
expires 1y;
|
||||
add_header Cache-Control "public, immutable";
|
||||
}
|
||||
|
||||
# API 代理 (如果需要)
|
||||
location /api/ {
|
||||
proxy_pass http://api.photography.iriver.top;
|
||||
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;
|
||||
}
|
||||
|
||||
# 健康检查
|
||||
location /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;
|
||||
}
|
||||
|
||||
# 安全配置 - 隐藏敏感文件
|
||||
location ~ /\. {
|
||||
deny all;
|
||||
}
|
||||
|
||||
location ~* \.(htaccess|htpasswd|ini|log|sh|sql|conf)$ {
|
||||
deny all;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user