我想设置以下结构: staging.mydomain.com/client/projectname production.mydomain.com/client/projectname
对于新项目,我在 /home/-文件夹中创建以下文件夹:
- “客户名称”-文件夹
- “项目名称”-文件夹
- 暂存文件夹
- 生产文件夹
- “项目名称”-文件夹
我制作了一个使用“a2ensite”启用的文件,包括下面显示的内容。
它与 clientA 一起用于“生产”和“登台”工作正常,但当然 clientB 不会工作,因为它类似于被 clientA 覆盖,对吧?
<VirtualHost *:80>
ServerName www.mydomain.com
ServerAlias mydomain.com
DirectoryIndex index.html index.php
DocumentRoot /home/mysite
</VirtualHost>
<VirtualHost *:80>
ServerName production.mydomain.com
ServerAlias production.mydomain.com
DirectoryIndex index.html index.php
DocumentRoot /home/clientA/projectA/production
Alias /clientA/projectA /home/clientA/projectA/production
</VirtualHost>
<VirtualHost *:80>
ServerName staging.mydomain.com
ServerAlias staging.mydomain.com
DirectoryIndex index.html index.php
DocumentRoot /home/clientA/projectA/staging
Alias /clientA/projectA /home/clientA/projectA/staging
</VirtualHost>
<VirtualHost *:80>
ServerName production.mydomain.com
ServerAlias production.mydomain.com
DirectoryIndex index.html index.php
DocumentRoot /home/clientB/projectA/production
Alias /clientB/projectA /home/clientB/projectA/production
</VirtualHost>
<VirtualHost *:80>
ServerName staging.mydomain.com
ServerAlias staging.mydomain.com
DirectoryIndex index.html index.php
DocumentRoot /home/clientB/projectA/staging
Alias /clientB/projectA /home/clientB/projectA/staging
</VirtualHost>