Apache的ReWrite的应用mod_rewrite模块使用(9)

来源:asp之家 时间:2010-04-04 18:44:00 

最后的说明:这样有用吗?www0.foo.com似乎也会超载呀?答案是:没错,它的确会超载,但是它超载的仅仅是简单的代理吞吐请求!所有诸如SSI、CGI、ePerl等等的处理完全是由其他机器完成的,这个才是要点。
硬件/TCP循环
还有一个硬件解决方案。Cisco有一个叫LocalDirector的东西,实现了TCP/IP层的负载均衡,事实上,它是一个位于网站集群前端的电路级网关。如果你有足够资金而且的确需要高性能的解决方案,那么可以用这个。
反向代理
说明:
...
方案:
代码:
##
## apache-rproxy.conf -- Apache configuration for Reverse Proxy Usage
##
# server type
ServerType standalone
Listen 8000
MinSpareServers 16
StartServers 16
MaxSpareServers 16
MaxClients 16
MaxRequestsPerChild 100
# server operation parameters
KeepAlive on
MaxKeepAliveRequests 100
KeepAliveTimeout 15
Timeout 400
IdentityCheck off
HostnameLookups off
# paths to runtime files
PidFile /path/to/apache-rproxy.pid
LockFile /path/to/apache-rproxy.lock
ErrorLog /path/to/apache-rproxy.elog
CustomLog /path/to/apache-rproxy.dlog "%t %h -> %e URL: %U"
# unused paths
ServerRoot /tmp
DocumentRoot /tmp
CacheRoot /tmp
RewriteLog /dev/null
TransferLog /dev/null
TypesConfig /dev/null
AccessConfig /dev/null
ResourceConfig /dev/null
# speed up and secure processing
Options -FollowSymLinks -SymLinksIfOwnerMatch
AllowOverride None
# the status page for monitoring the reverse proxy
SetHandler server-status
# enable the URL rewriting engine
RewriteEngine on
RewriteLogLevel 0
# define a rewriting map with value-lists where
# mod_rewrite randomly chooses a particular value
RewriteMap server rnd:/path/to/apache-rproxy.conf-servers
# make sure the status page is handled locally
# and make sure no one uses our proxy except ourself
RewriteRule ^/apache-rproxy-status.* - [L]
RewriteRule ^(http|ftp)://.* - [F]
# now choose the possible servers for particular URL types
RewriteRule ^/(.*.(cgi|shtml))$ to://$/$1 [S=1]
RewriteRule ^/(.*)$ to://$/$1
# and delegate the generated URL by passing it
# through the proxy module
RewriteRule ^to://([^/]+)/(.*) http://$1/$2 [E=SERVER:$1,P,L]
# and make really sure all other stuff is forbidden
# when it should survive the above rules...
RewriteRule .* - [F]
# enable the Proxy module without caching
ProxyRequests on
NoCache *
# setup URL reverse mapping for redirect reponses
ProxyPassReverse / http://www1.foo.dom/
ProxyPassReverse / http://www2.foo.dom/
ProxyPassReverse / http://www3.foo.dom/
ProxyPassReverse / http://www4.foo.dom/
ProxyPassReverse / http://www5.foo.dom/
ProxyPassReverse / http://www6.foo.dom/
##
## apache-rproxy.conf-servers -- Apache/mod_rewrite selection table
##
# list of backend servers which serve static
# pages (HTML files and Images, etc.)
static www1.foo.dom|www2.foo.dom|www3.foo.dom|www4.foo.dom
# list of backend servers which serve dynamically
# generated page (CGI programs or mod_perl scripts)
dynamic www5.foo.dom|www6.foo.dom

标签:apache,mod_rewrite,url,rewrite,虚拟主机,服务器
0
投稿

猜你喜欢

  • 优酷再遭反盗版联盟诉讼 被指盗版行为无改善

    2010-03-04 08:53:00
  • Linux编译LVGL仿真器出错问题解决

    2023-07-10 11:18:10
  • 抗DoS、DDoS防火墙产品大检阅

    2009-12-24 15:01:00
  • 浅谈影响外部链接权重的十大因素

    2009-01-16 15:05:00
  • win2003 server下的IIS Session丢失原因与解决方案小结

    2010-02-26 10:18:00
  • 网页设计之论摹仿和抄袭的区别

    2008-05-23 18:18:00
  • 十大步骤提高Domino邮件服务器性能

    2009-02-26 17:29:00
  • docker中如何将jar包构建成镜像并执行

    2022-08-22 12:48:58
  • Godaddy中FTP使用的问题

    2010-04-17 13:15:00
  • Dedecms织梦内容管理系统发布5.5GBK版下载

    2009-08-02 07:58:00
  • 详解VMware虚拟机网络连接模式(NAT,Bridged,Host-only)

    2022-08-29 23:48:38
  • Win2K服务器端安全设置教程(1)

    2007-12-04 10:29:00
  • Windows服务器安全维护的几个需要注意点

    2009-01-06 17:04:00
  • 谈谈中国人做英文站的优势和劣势

    2008-11-24 16:22:00
  • 不很厚道或许有用的办法 包装网站关键词

    2008-12-20 13:46:00
  • 服务器FTP站点的建立与维护[图]

    2007-10-31 19:01:00
  • 看看Google公司都有什么牛人?

    2008-02-03 14:29:00
  • 如何利用datafeedr轻松打造一个销售站

    2009-03-11 10:14:00
  • 支付宝功能介绍图

    2009-10-14 16:27:00
  • 十大设计精美的基于WordPress的网站

    2010-08-31 16:59:00
  • asp之家 网站运营 m.aspxhome.com