DivmodNevow/Deployment/ReverseProxy - Divmod - Trac
来源:百度文库 编辑:神马文学网 时间:2024/04/28 14:12:41
Search:
Login
Settings
Help/Guide
About Trac
Register
Wiki
Timeline
Roadmap
Browse Source
View Tickets
Search
Wiki Navigation
Start Page
Index by Title
Index by Date
Last Change
Nevow Deployment : Reverse Proxy ¶
A Reverse Proxy forwards the requests it receives from the internet to one or more slave webservers. Lighttpd and Apache both provide reverse proxy modules. Any absolute urls in the response will contain thescheme(possibly the hostname) and port number on which the slave is running.These must be rewritten before being returned to the client. In Nevow this can be handled byvhost.VHostMonsterResource.
Example 1 ¶
You have an existing webserver running on port 80, doingname based virtual hosting of several existing websites and want to run a Nevow based site alongside them on the same IP.
Solution ¶
Forward all requests at this virtual host to the Nevow slave server.
Sample Nevow App ¶
from zope.interface import implementsfrom twisted.application import service, strportsfrom nevow import appserver, inevow, loaders, rend, url, vhostclass MyPage(rend.Page):"""I am a simple resource for demo purposes only. I will return a "MyPage"for any child you ask me to locate. I display the current url as calculatednevow.url."""addSlash = TruedocFactory = loaders.xmlstr("""
Save as eg sample.tac and run using twistd -noy sample.tac
Sample Lighttpd Config: ¶
$HTTP["host"] =~ "^(www.example.com)$" {url.rewrite-once = ("^/(.*)" => "/vhost/http/%0/$1")# In lighttpd we alter the path manually using rewrite rule. %0 refers to the hostname and $1 is the path.proxy.server = ( "" =>( ("host" => "127.0.0.1","port" => 8080) ))}
If you prefer a mixed deployment strategy where static content is served through the faster lighttpd while dynamic content is still served by twisted you can use the following recipe.
$HTTP["host"] =~ "^(www.example.org)$" {url.rewrite-once = ("^/static/.*" => "$0","^/(.*)" => "/vhost/http/%0/$1")$HTTP["url"] !~ "^/static/" {proxy.server = ( "" =>( ("host" => "127.0.0.1","port" => 8080) ))}server.document-root = "/path/to/your/project/trunk/"}
There are 2 assumptions in this recipe:
The static content is located at the /static/ subtree of the website.
The project root contains a ‘static‘ directory that is used to serve static content.
Sample Apache Config (Ref) ¶
Nevow is only to be used for part of an existing static site at a non-root url
Sample Lighttpd Config: ¶
TODO
Sample Apache Config ¶
TODO
See Also ¶
http://lighttpd.net/documentation/proxy.html
http://httpd.apache.org/docs/2.0/mod/mod_proxy.html#proxypass
Download in other formats:
Plain Text
Powered byTrac 0.10.4
ByEdgewall Software.
© 2006-2008 Divmod, Inc.
All rights reserved.
jethro@divmod.org
DivmodNevow/Deployment/ReverseProxy - Divmod - Trac
Motorola HSDPA deployment
web.xml Deployment Descriptor Elements
web.xml Deployment Descriptor Elements
Install Trac under Ubuntu
The Trac Project
Install Trac under Ubuntu
TracOnWindows - Prelude Hybrid IDS - Trac
松窗竹户:SVN Trac安装笔记
基于 Debian 的 Subversion Trac
Trac在Windows下的安装配置
项目开发平台搭建:svn+trac+viewvc
Host your own project with Trac
手机二维码~~~ZXing简介 - mobile - j2bb - Trac
[LFS 幻想系列] Trac Subversion Apache-DAV ViewVC. - LinuxSir.Org
Debian Linux 架設 Trac Virtual Host | Tsung's Blog
老鸟rhel5/centos5服务器架设笔记:Trac SVN Apache架设进阶篇 - snakeskin - JavaEye技术网站