mirror of
https://github.com/fastapiadmin/FastapiAdmin.git
synced 2026-10-16 22:51:14 +00:00
feat: 重构前端项目结构并优化代码
refactor: 迁移前端资源文件至web目录 feat: 新增多种图标资源 style: 统一代码风格和格式化配置 docs: 更新README和文档说明 chore: 更新依赖和配置文件 fix: 修复部分类型定义和枚举 perf: 优化路由和组件加载逻辑
This commit is contained in:
@@ -0,0 +1,91 @@
|
||||
# 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;
|
||||
keepalive_timeout 75;
|
||||
|
||||
# HTTP server块 - 重定向到HTTPS
|
||||
server {
|
||||
listen 80;
|
||||
server_name service.fastapiadmin.com;
|
||||
return 301 https://$server_name$request_uri;
|
||||
}
|
||||
|
||||
# HTTPS server块
|
||||
server {
|
||||
listen 443 ssl http2;
|
||||
server_name service.fastapiadmin.com;
|
||||
|
||||
# SSL证书配置
|
||||
ssl_certificate /etc/nginx/ssl/server.pem;
|
||||
ssl_certificate_key /etc/nginx/ssl/server.key;
|
||||
|
||||
# SSL优化配置
|
||||
ssl_protocols TLSv1.2 TLSv1.3;
|
||||
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA384;
|
||||
ssl_prefer_server_ciphers on;
|
||||
ssl_session_cache shared:SSL:10m;
|
||||
ssl_session_timeout 10m;
|
||||
|
||||
# 官网 - 根路径访问官网
|
||||
location / {
|
||||
root /usr/share/nginx/html/docs/dist;
|
||||
index index.html index.htm;
|
||||
try_files $uri $uri/ /index.html;
|
||||
}
|
||||
|
||||
# 前端 - /web访问前端
|
||||
location /web {
|
||||
alias /usr/share/nginx/html/web/dist;
|
||||
try_files $uri $uri/ /web/index.html;
|
||||
}
|
||||
|
||||
# 小程序 - /app访问小程序
|
||||
location /app {
|
||||
alias /usr/share/nginx/html/app/dist/build/h5;
|
||||
try_files $uri $uri/ /app/index.html;
|
||||
}
|
||||
|
||||
# 后端代理
|
||||
location /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-Forwarded-Proto $scheme;
|
||||
proxy_set_header X-NginX-Proxy true;
|
||||
proxy_connect_timeout 300s;
|
||||
proxy_send_timeout 300s;
|
||||
proxy_read_timeout 300s;
|
||||
proxy_pass http://backend:8001;
|
||||
|
||||
# WebSocket 支持
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
}
|
||||
|
||||
error_page 500 502 503 504 /50x.html;
|
||||
location = /50x.html {
|
||||
root /usr/share/nginx/html;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user