Here is the solution to this problem:
Basically we use Apache at port 80 as a proxy and redirect links to
different TurboGears applications that are running at different ports.
1 - Configure Apache to act as a proxy
a - Install mod_proxy with the following two commands:
sudo apt-get install apache2-mpm-prefork
sudo a2enmod proxy_http
b - Edit /etc/apache2/sites-enabled/000-default to include
proxy information:
In this file, before the </VirtualHost> line, type
<Proxy *>
Allow from all
</Proxy>
ProxyPass /mypath/ http://localhost:8000/
ProxyPassReverse /mypath/ http://localhost:8000/
ProxyPass /secondapp/ http://localhost:8001/
ProxyPassReverse /secondapp/ http://localhost:8001/
This will forward all requests at http://server.com/mypath/
to the TurboGears application running at port 8000 and vice versa.
In the second example, the URL mapping is:
http://server.com/secondapp/
<--> TurboGears application running at port 8001
2 - Configure your TurboGears
a - Edit 'dev.cfg' found in your TG application folder and
include the following two lines:
server.webpath = "/mypath"
server.socket_port=8000
where "/mypath" is the URL offset that you wish to use and
8000 is the port you would like your TG application to run on.
3 - Restart Apache and your TurboGears application
sudo /etc/init.d/apache2 stop
sudo /etc/init.d/apache2 start
Now if you type http://server.com/mypath/ in your browser, it should
go to your TurboGears application's index page.
Notes:
In your TurboGears controllers or templates, make sure to wrap all
links with turbogears.url("/relativeLink") function so the webpath can
be appended to the front of the URL. So turbogears.url("/test") should
come out as "/mypath/test".
To direct to the root path, use turbogears.url("./") instead of "/"
Ideally, you should be able to access your TurboGears application from
the browser using http://server.com:8000. This solution is only meant
for those who only have a limited number of open ports to use for web
access.
Hope this helps.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---