Files
FastapiAdmin/devops/nginx/nginx.conf
T
zhangtao 1bc59f0da5 feat: 重构项目结构并新增fastdocs文档工程
- 新增fastdocs文档工程,使用vitepress 2.0构建
- 将原frontend/docs下的文档资源迁移至fastdocs工程
- 优化nginx配置,支持多项目部署路由
- 更新README文档,调整图片引用路径
- 移除旧的start.sh脚本,新增更完善的deploy.sh部署脚本
- 调整docker-compose配置,支持多项目部署
- 修复fastapp中qiun-data-charts组件willReadFrequently属性问题
- 更新项目依赖版本,统一使用pnpm管理
- 优化项目结构,分离前端、小程序和文档工程
2025-08-17 00:59:54 +08:00

74 lines
2.5 KiB
Nginx Configuration File

# For more information on configuration, see:
# * Official English Documentation: http://nginx.org/en/docs/
# * Official Russian Documentation: http://nginx.org/ru/docs/
########### 每个指令必须有分号结束。#################
worker_processes 1; # 允许生成的进程数,默认为1:
pid /var/run/nginx.pid; # 指定 Nginx 进程运行文件存放地址
error_log /var/log/nginx/error.log;
events {
accept_mutex on; # 设置网络连接序列化,防止惊群现象发生,默认为on
multi_accept on; # 设置一个进程是否同时接受多个网络连接,默认为off
use epoll; # 事件驱动模型,select|poll|kqueue|epoll|resig|/dev/poll|eventport
worker_connections 1024; # 最大连接数,默认为512
}
http {
include mime.types; # 文件扩展名与文件类型映射表
default_type application/octet-stream; # 默认文件类型,默认为text/plain
# 访问服务日志
access_log on;
sendfile on; # 允许sendfile方式传输文件,默认为off,可以在http块、server块、location块
keepalive_timeout 75; # 连接超时时间,默认为75秒,可以在http、server、location块
# server 块
server {
# 监听端口
listen 80;
# 服务名
server_name frontend;
# 官网代理
location / {
root /usr/share/nginx/html; #nginx容器规定位置;
index index.html index.htm;
try_files $uri $uri/ /fastdocs/index.html; #解决页面刷新404问题
}
# 前端代理
location /web {
root /usr/share/nginx/html; #nginx容器规定位置;
index index.html index.htm;
try_files $uri $uri/ /frontend/index.html; #解决页面刷新404问题
}
# 小程序代理
location /app {
root /usr/share/nginx/html; #nginx容器规定位置;
index index.html index.htm;
try_files $uri $uri/ /fastapp/index.html; #解决页面刷新404问题
}
# 后端代理
location /gateway/api/v1 {
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-NginX-Proxy true;
proxy_pass http://172.18.52.77:8001;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}
}