本帖最后由 宝塔用户_canchp 于 2025-10-9 20:48 编辑
为了能快速了解并处理您的问题,请提供以下基础信息: 各位大佬 我想让 tenantapi 的请求 单独走一个 location里 并且根目录 单独在location里设置 , 项目 目录 app 下面分了多个目录 tenantapi 和其他的 有什么解决方案吗 nginx 不太熟悉,求指教。
listen 80;
server_name 2b7168.test6.com test6.com;
index index.php index.html index.htm default.php default.htm default.html;
# root D:/wwwroot/sass-oa/judianshang/server/public;
# 处理 tenantapi 前缀的所有请求
location ^~/tenantapi/ {
# Tenant API 路由处理
alias D:/wwwroot/sass-oa/judianshang/server/public;
if (!-e $request_filename) {
rewrite ^/tenantapi/(.*)$ /index.php?s=/tenantapi/$1 last;
break
}
}
location ~ \.php(.*)$ {
try_files $uri =404;
fastcgi_pass 127.0.0.1:20080;
fastcgi_index index.php;
set $real_script_name $fastcgi_script_name;
if ($fastcgi_script_name ~ "^(.+?\.php)(/.+)$") {
set $real_script_name $1;
set $path_info $2;
}
fastcgi_param SCRIPT_FILENAME $document_root$real_script_name;
fastcgi_param SCRIPT_NAME $real_script_name;
fastcgi_param PATH_INFO $path_info;
include fastcgi_params;
}
|
|