Apache 2虚拟主机共享1个公共目录
我有两个虚拟站点,它们位于指定目录之外的同一目录。比如说Apache 2虚拟主机共享1个公共目录,apache,virtualhost,Apache,Virtualhost,我有两个虚拟站点,它们位于指定目录之外的同一目录。比如说 example1.com -> /var/www/example1 /var/www/example1/index.html meta redirects to /var/www/common/index.php?id=example1 example2.com -> /var/www/example2 /var/www/example2/index.html meta redirects to /var/www/commo
example1.com -> /var/www/example1
/var/www/example1/index.html meta redirects to /var/www/common/index.php?id=example1
example2.com -> /var/www/example2
/var/www/example2/index.html meta redirects to /var/www/common/index.php?id=example2
问题是我得到了一个apachenotfound错误。然而,“locahost/example1
”工作正常,“locahost/example2
”工作正常。问题可能出在虚拟主机配置上
两者都是(缩写)
ServerName example1.com
DocumentRoot/var/www/example1
ServerName example2.com
DocumentRoot/var/www/example2
有什么建议吗?关于它的价值,我想不出来。我最终在web根目录中创建了两个虚拟服务器,然后使用服务器端php控制内容。如果有人认为这不好,或者对这个问题有实际的答案,我很想知道
<VirtualHost *:80>
ServerName example1.com
DocumentRoot /var/www/example1
</VirtalHost>
<VirtualHost *:80>
ServerName example2.com
DocumentRoot /var/www/example2
</VirtalHost>