play framework学习笔记之 front-end HTTP server
来源:互联网 发布:注会网络课如何 编辑:程序博客网 时间:2024/03/29 05:56
使用lighttpd
Set-up with lighttpd
This example shows you how to configure lighttpd as a front-end web server. Note that you can do the same with Apache, but if you only need virtual hosting or load balancing, lighttpd is a very good choice and much easier to configure!
The /etc/lighttpd/lighttpd.conf file should define things like this:
server.modules = ( "mod_access", "mod_proxy", "mod_accesslog" )...$HTTP["host"] =~ "www.myapp.com" { proxy.balance = "round-robin" proxy.server = ( "/" => ( ( "host" => "127.0.0.1", "port" => 9000 ) ) )} $HTTP["host"] =~ "www.loadbalancedapp.com" { proxy.balance = "round-robin" proxy.server = ( "/" => ( ( "host" => "127.0.0.1", "port" => 9000 ), ( "host" => "127.0.0.1", "port" => 9001 ) ) )}
使用apache 代理 play
Set-up with Apache
The example below shows a simple set-up with Apache httpd server running in front of a standard Play configuration.
LoadModule proxy_module modules/mod_proxy.so...<VirtualHost *:80> ProxyPreserveHost On ServerName www.loadbalancedapp.com ProxyPass / http://127.0.0.1:9000/ ProxyPassReverse / http://127.0.0.1:9000/</VirtualHost>
###########例子代码################################################
LoadModule proxy_module modules/mod_proxy.soLoadModule proxy_http_module modules/mod_proxy_http.soNameVirtualHost 188.188.1.109:80<VirtualHost 188.188.1.109:80> ServerName 188.188.1.109 Alias /hy2 "D:/webapp/hy2" ProxyPreserveHost On ProxyPass / http://188.188.1.109:9000/
ProxyPassReverse / http://188.188.1.109:9000/
</VirtualHost>
其中注意 http://188.188.1.109:9000/ 最后的那一个 / 很重要
此处除了load模块 proxy_module 外还要导入相对的子 module如 我们这里用到了 http协议,那么就要用到 proxy_http_module这个子模块,此外还有ftp,balancer等其它对应的子模块
使用apache负载均衡
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_http_module modules/mod_proxy_http.so
LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
<VirtualHost 188.188.1.109:80>
ServerName 188.188.1.109
<Location /balancer-manager>
SetHandler balancer-manager
Order Deny,Allow
Deny from all
Allow from ALL
</Location>
<Proxy balancer://mycluster>
BalancerMember http://localhost:9000
#这里可以用localhost
BalancerMember http://localhost:9001 status=+H
#+H的意思是 备用的意思
</Proxy>
<Proxy *>
Order Allow,Deny
Allow From All
</Proxy>
ProxyPreserveHost On
ProxyPass /balancer-manager !
ProxyPass / balancer://mycluster/
ProxyPassReverse / http://localhost:9000/
ProxyPassReverse / http://localhost:9001/
</VirtualHost>
使用了负载均衡了之后如果你的主力服务器挂了,或者在升级,那么的备用的会替换上,接着干
- play framework学习笔记之 front-end HTTP server
- play framework学习笔记之 framework ID
- play framework学习笔记之测试test
- play framework学习笔记之yml
- play framework学习笔记之 数据库
- play framework学习笔记之 模板引擎
- play framework学习笔记之 部署项目
- play framework学习笔记之 jobs
- play framework学习笔记之play tags页面模板
- play framework学习笔记
- play framework学习笔记之 非HTTP环境下执行任务使用job
- Play!Framework学习笔记:初识Play
- play framework学习笔记之模型域model
- play framework学习笔记之 conf/routes file 路径配置文件
- play framework学习笔记之 发送 e-mail
- play framework学习笔记之 Security Guide 安全机制
- play framework学习笔记之 ajax集成使用
- play framework学习笔记之 身份识别,openID
- TFS2010版本
- hibernate 使用连接池连接数据库时 自动断开处理
- C#设计模式-合成模式-案例分析
- 《Windows CE大排档》第一版勘误表
- ie6与ie7 Window.Open() 和 window.showModalDialog()参数
- play framework学习笔记之 front-end HTTP server
- linux下JDK的bin安装方法
- Android中判断网络功能是否可用
- 为什么不用我?
- MySQL Administrator :: Mysql Administrator error "Could not find settings"
- 使用正則表式的步驟
- dos命令之Dir详解及实例应用1
- 使用VFW在windows下编程控制摄像头
- 如何写TreeView(JAVA)