更新
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
# AI Chat 生产环境 Nginx 配置示例
|
||||
# 网站根目录必须指向 backend/public
|
||||
# phpstudy:网站 -> 设置 -> 配置文件,粘贴以下 server 块内容
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
# listen 9998; # 若使用自定义端口
|
||||
server_name chat.zhenyangtang.com.cn;
|
||||
|
||||
root D:/web/chat/backend/public;
|
||||
index index.html index.php;
|
||||
|
||||
client_max_body_size 100m;
|
||||
|
||||
# ===== 1. API 必须优先走 PHP(不要走 SPA 的 index.html)=====
|
||||
location ^~ /api {
|
||||
rewrite ^ /index.php?s=$uri last;
|
||||
}
|
||||
|
||||
# ===== 2. PHP 处理 =====
|
||||
location ~ \.php$ {
|
||||
fastcgi_pass 127.0.0.1:9000; # phpstudy 可能是 9000 或 9001,按实际修改
|
||||
fastcgi_index index.php;
|
||||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||
include fastcgi_params;
|
||||
}
|
||||
|
||||
# ===== 3. 管理后台 SPA =====
|
||||
location ^~ /admin/ {
|
||||
try_files $uri $uri/ /admin/index.html;
|
||||
}
|
||||
location = /admin {
|
||||
return 301 /admin/;
|
||||
}
|
||||
|
||||
# ===== 4. 会员端 SPA =====
|
||||
location / {
|
||||
try_files $uri $uri/ /index.html;
|
||||
}
|
||||
|
||||
# ===== 5. 静态资源缓存 =====
|
||||
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff2?)$ {
|
||||
expires 7d;
|
||||
access_log off;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user