首页 > 解决方案 > Nginx:第一个文件夹的通配符

问题描述

我正在努力创建一个使用动态文件夹名称的 Nginx 规则。我有 2 个应用程序:

app1: /
app2: /resident

他们的网址如下:

app1:
  /dashboard
  /login

app2:
  /resident/dashboard
  /resident/login

到目前为止,我设法让 Nginx 工作,发送//var/www/app1和发送/resident/var/www/app2. 现在,我们需要在 URL 中添加客户名称。像这样:

app1:
  /:customer/dashboard
  /:customer/login

app2: 
  /:customer/resident/dashboard
  /:customer/resident/login

:customer是一个变量,它仍应进入相同的文件系统文件夹: /:customer/=>/var/www/app1/:customer/resident=>/var/www/app2

我尝试了不同的方法,不同的正则表达式/订单。没有成功。

标签: nginx

解决方案


推荐阅读