【发布时间】:2021-06-04 13:28:36
【问题描述】:
我有两个网络应用程序共享相同的资产(js、css、img 等),但使用不同的子域/文档根目录。
我试图弄清楚如何在两个文档根目录之间共享一个资产文件夹,这样我就可以避免在对资产应用更改后必须更改每个子域的资产文件夹。
感谢您的宝贵时间。
当前结构:
www/html
├─ subdomain1
│ └─ assets
│ └─ index.php
└─ subdomain2
└─ assets
└─ index.php
所需结构:
www/html
├─ assets
├─ subdomain1
│ └─ index.php
└─ subdomain2
└─ index.php
VHost Confs:
子域一:
<VirtualHost *:80>
ServerName www.one.mydomain.com
ServerAlias one.mydomain.com
ServerAdmin admin@example.com
DocumentRoot /var/www/html/subdomain1/
<Directory /var/www/html/subdomain1/>
Options -Indexes +FollowSymLinks
AllowOverride All
DirectoryIndex index.php
</Directory>
ErrorLog /var/www/html/logs/subdomain1-error.log
CustomLog /var/www/html/logs/subdomain1-access.log combined
</VirtualHost>
子域二:
<VirtualHost *:80>
ServerName www.two.mydomain.com
ServerAlias two.mydomain.com
ServerAdmin admin@example.com
DocumentRoot /var/www/html/subdomain2/
<Directory /var/www/html/subdomain2/>
Options -Indexes +FollowSymLinks
AllowOverride All
DirectoryIndex index.php
</Directory>
ErrorLog /var/www/html/logs/subdomain2-error.log
CustomLog /var/www/html/logs/subdomain2-access.log combined
</VirtualHost>
【问题讨论】:
标签: php apache centos subdomain virtualhost