(2)在防火墙上配置反向代理技术.
在/etc/httpd/conf/httpd.conf中加入 NameVirtualHost xxx.xxx.xxx.xxx
# xxx.xxx.xxx.xxx ----->是防火墙外部在互联网上永久IP地址
servername www.XXXX.com
errorlog /var/log/httpd/error_log
transferlog /var/log/httpd/access_log
rewriteengine on
proxyrequests off
usecanonicalname off
rewriterule ^/(.*)$ http://xxx.xxx.xx.x/$1 Apache服务器的IP地址。
servername http://download.XXXX.com/pub/
errorlog /var/log/httpd/download/error_log
transferlog /var/log/httpd/download/access_log
rewriteengine on
proxyrequests off
usecanonicalname off
rewriterule^/(.*)$http://xxx.xxx.xx.x/$1 同上Apache服务器的IP地址。
设置防火墙上的DNS,让download.XXXX.com和www.XXXX.com都指向防火墙的外部网地址xxx.xxx.xxx.xxx。用http://www.XXXX.com访问主页,用http://download.XXXX.com/pub/访问公共文件的下载区。
注:还需要在apache服务器主机上建立目录/var/log/httpd/download/,否则会出错。另外,也可以设置防火墙主机上的/home/httpd/html/index.html的属性为750来阻止访问,这是防外部用户能访问到防火墙上的Apache服务器的http://www.XXXX.com中。
总结:Apache Server是一个非常优秀,非常棒的服务器,只要你正确配置和维护好Apache服务器,你就会感受到Apache Server 所带来的好处。