Hope this hasn't been discussed recently - I googled and searched the archives but I'm tired so I will blame that...
Is there any documentation/advice on how to run Twisted apps behind/alongside Apache?
My situation is as follows:
All our servers run Apache on port 80, I have root access etc so that's no problem.
A new project I'm looking at starting soon will hopefully be based around Twisted/Nevow and I want to run it on our servers.
How do I configure Apache so that it passes everything (or certain things, could have apache still server static html/images/js/css etc..) onto the twisted app which I assume will be listening on a port other than 80.
Any other advice on ways to set this up before I start messing about and breaking our dev box tomorrow?
:o)
Thanks in advance.
Is there any documentation/advice on how to run Twisted apps behind/alongside Apache?
The project I'm currently working on has the setup you are looking for. The solution is to run the twisted app as normal and use mod_proxy to get apache to forward any requests to it. The apache VirtualHost configuration directive I'm using at the moment is as follows:
<VirtualHost *> ServerAdmin you@wherever.com ServerName virtualhostname.domain.com
ProxyVia On ProxyPass / http://127.0.0.1:8765/ ProxyPassReverse / http://127.0.0.1:8765/ </VirtualHost>
This is assuming the twisted app is running on port 8765. I also have a few other items in the configuration file related to preventing caching of pages, but the above should get you able to access the twisted app via a virtual host on port 80.
Regards,
Mark
-=<[ Mark Harrison ]-[ Email: mark@mivok.net ]-[ Jabber: mivok@mivok.net ]>=- -=<[ Web: http://www.mivok.net/ ]>=-
<VirtualHost *:80> # This virtual host is simply a proxy of the twisted-matrix # woven based site running on local port 8080 ServerName www.yoursite.com
RewriteEngine On RewriteRule ^(.+)$ http://127.0.0.1:8080$1 [P] ProxyVia Block
# Maintain logging as twistd only sees local proxy requests CustomLog logs/site-access.log combined ErrorLog logs/site-error.log </VirtualHost>
Is there a fix for vhostmonster dreid?
That proxypass technique doesn't give my pastebin very good URLs.
Is there a fix for vhostmonster dreid?
That proxypass technique doesn't give my pastebin very good URLs.
Forgive me if I'm being a little clueless here (I've not used vhostmonster and have just read about what it is), but what problems are there when you use the ProxyPassReverse directive in apache to deal with the redirects etc. and use relative (or relative to site root) links in any pages you generate? I'm assuming here that vhostmonster also rewrites links in pages before sending them to the client.
The reason I'm asking is that is what I am doing now, and haven't noticed any problems (yet!). Is there anything else I should be looking out for?
Mark
-=<[ Mark Harrison ]-[ Email: mark@mivok.net ]-[ Jabber: mivok@mivok.net ]>=- -=<[ Web: http://www.mivok.net/ ]>=-
Mark Harrison wrote:
Is there a fix for vhostmonster dreid?
That proxypass technique doesn't give my pastebin very good URLs.
Forgive me if I'm being a little clueless here (I've not used vhostmonster and have just read about what it is), but what problems are there when you use the ProxyPassReverse directive in apache to deal with the redirects etc. and use relative (or relative to site root) links in any pages you generate? I'm assuming here that vhostmonster also rewrites links in pages before sending them to the client.
The reason I'm asking is that is what I am doing now, and haven't noticed any problems (yet!). Is there anything else I should be looking out for?
Indeed, there is no problem if all of your resources use relative links.
However, if they generate absolute links, which many apps do (:-(), VHostMonster is to the rescue. It replaces stuff like the hostname in the request object with the 'external' one, so when code builds URLs with it, they're externally referenceable.
But VHostMonster reportedly doesn't work with Nevow, yet.
Yes, i worked on VHostMonster not long ago, and with fzZzy's help it got fixed and works, though I'm really going to have to dig through the code and figure out what kind of evil broken magic makes it necessary.
http://www.divmod.org/users/roundup.twistd/nevow/issue46
On Mon, 2004-04-19 at 15:02, Kai Hendry wrote:
Is there a fix for vhostmonster dreid?
That proxypass technique doesn't give my pastebin very good URLs.
Twisted-web mailing list Twisted-web@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-web
http://divmod.org/users/wiki.twistd/nevow/moin.cgi/ApacheSetup
I made a little Wiki entry to help.