一个文件服务器 多个域名 想当于多线程访问文件 这样的页面加载的速度大大提升
首先需要我们申请 img1-8.ishenbian.com 这几个域名
在我们这个项目中运用到 应用技术是 resin+apache 一个文件服务器(内有apache服务器) 4个应用服务器
多域名 设置需要在文件服务器上的apache 下的conf/extra/httpd-vhosts.conf 这个文件。
设置如下:
NameVirtualHost *:80
<VirtualHost *:80>
DocumentRoot "/data/oradata/filelocation"
ServerName file.ishenbian.com
<Directory /data/oradata/filelocation/>
Options -Indexes FollowSymLinks
AllowOverride all
Order allow,deny
Allow from all
</Directory>
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_METHOD} ^(TRACE|TRACK)
RewriteRule .* - [F]
RewriteRule ^/user/([0-9]{4})([0-9]{3})([0-9]{3})/(.*) /user/$1/$2/$3/$4 [PT,NE]
RewriteRule ^/poi/([0-9]{4})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})/(.*) /poi/$1/$2/$3/$4/$5/$6/$7 [PT,NE]
ErrorDocument 404 /default/title_max.jpg
</IfModule>
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "/data/oradata/filelocation"
ServerName file1.ishenbian.com
<Directory /data/oradata/filelocation/>
Options -Indexes FollowSymLinks
AllowOverride all
Order allow,deny
Allow from all
</Directory>
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_METHOD} ^(TRACE|TRACK)
RewriteRule .* - [F]
RewriteRule ^/user/([0-9]{4})([0-9]{3})([0-9]{3})/(.*) /user/$1/$2/$3/$4 [PT,NE]
RewriteRule ^/poi/([0-9]{4})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})/(.*) /poi/$1/$2/$3/$4/$5/$6/$7 [PT,NE]
ErrorDocument 404 /default/title_max.jpg
</IfModule>
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "/data/oradata/filelocation"
ServerName img1.ishenbian.com
<Directory /data/oradata/filelocation/>
Options -Indexes FollowSymLinks
AllowOverride all
Order allow,deny
Allow from all
</Directory>
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_METHOD} ^(TRACE|TRACK)