具有公共文件的多个站点的Apache设置

时间:2009-11-16 10:40:25

标签: php apache vhosts suexec

我有大约50个网站都使用完全相同的文件而不是CSS和IMAGES,我目前每次创建一个新网站并上传不同的CSS和图像时都会复制这些文件。

我想要的是这样设置每个vhost以使其具有相同的 DocumentRoot ,然后为其添加 AliasMatch css和图像文件夹例如:

#Common Files VHOST
<VirtualHost xxx.xxx.xxx.xxx:80>
    ServerName commonfiles.com
    ServerAlias www.commonfiles.com
    DocumentRoot /home/commonfiles/public_html
</VirtualHost>

#Sample vhost for 1 of the 50 sites.
<VirtualHost xxx.xxx.xxx.xxx:80>
    ServerName mytest.com
    ServerAlias www.mytest.com
    DocumentRoot /home/commonfiles/public_html
    ......
    AliasMatch /css/(.*) /home/ftpuser/public_html/mycss/$1
</VirtualHost>

别名适用于定制文件,但由于权限错误,无法访问公共文件:

[Mon Nov 16 09:31:01 2009] [crit] [client xxx.xxx.xxx.xxx] (13)Permission denied: /home/commonfiles/public_html/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable

这是我认为可能是问题的一部分的当前服务器设置(以前的服务器管理员设置了这个):

  • Apache(Apache / 2.2.14(Unix)
  • PHP 5.2.11
  • CentOS 4.8 i686标准
  • PHP 5处理程序是dso
  • Apache suEXEC已开启

有什么建议吗?

3 个答案:

答案 0 :(得分:2)

默认情况下,public_html文件夹的权限为750,我更改为755并更新了open_basedir限制,所有内容都开始运行良好。

我必须确保每个网站仍然可以拥有.htaccess。

答案 1 :(得分:0)

听起来不像AliasMatch是问题,错误消息指向你的htaccess文件。你检查了权限吗? Wbich用户是否属于?

答案 2 :(得分:0)

另一个解决方案是在每个域上创建指向公共文件所在文件夹的符号链接。