在一些情况下,经常会使用apache的proxy功能,具体含义就是在满足某些情况下apache代替用户进行http的转请求, 网上到处都是的代理功能即是本功能的具体应用。
使用proxy,需要装上mod_proxy的apache的dso,然后在apache中增加类似如下的配置文件
<VirtualHost *:80>
ServerName img.aaa.bbb.com
DocumentRoot /home/share/htdocs/img
ErrorLog logs/apache/img/error
RewriteEngine On
# RewriteLogLevel 4
RewriteLog "logs/yapache/rewritelog_yimg"
RewriteCond /home/share/htdocs/img/%{REQUEST_FILENAME} !-f
RewriteRule ^/(.+)$ http://img01.img.aaa.bbb.com/cn/$1 [QSA,P,L]
</VirtualHost>
使用proxy,需要装上mod_proxy的apache的dso,然后在apache中增加类似如下的配置文件
<VirtualHost *:80>
ServerName img.aaa.bbb.com
DocumentRoot /home/share/htdocs/img
ErrorLog logs/apache/img/error
RewriteEngine On
# RewriteLogLevel 4
RewriteLog "logs/yapache/rewritelog_yimg"
RewriteCond /home/share/htdocs/img/%{REQUEST_FILENAME} !-f
RewriteRule ^/(.+)$ http://img01.img.aaa.bbb.com/cn/$1 [QSA,P,L]
</VirtualHost>