我有一些像这样的链接
http://www.domain1.com/files/domain1.com/files/def.jpg
http://super.domain1.com/files/super.domain1.com/files/abc.jpg
http://www.other1.com/files/other1.com/files/uhj.jpg
这些网站托管在相同的托管和共享文件文件夹中。我们使用名为网站域名的子文件夹将它们分开。但是,属于domain1.com的文件:
http://www.domain1.com/files/domain1.com/files/def.jpg
可以通过网址访问
http://www.other1.com/files/domain1.com/files/def.jpg
如何防止这种情况?
答案 0 :(得分:0)
为每个域单独配置vhost到域文件夹。
我在下面发布的vhost配置示例。
<VirtualHost *:80>
ServerAdmin webmaster@localhost
ServerName www.domain1.com
DocumentRoot /home/domains/files/super.domain1.com/
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /home/domains/files/super.domain1.com/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
ErrorLog /var/log/apache2/error.log
LogLevel warn
CustomLog /var/log/apache2/access.log combined
</VirtualHost>
<VirtualHost *:80>
ServerAdmin webmaster@localhost
ServerName domain1.com
DocumentRoot /home/domains/files/super.domain1.com/
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /home/domains/files/super.domain1.com/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
ErrorLog /var/log/apache2/error.log
LogLevel warn
CustomLog /var/log/apache2/access.log combined
</VirtualHost>