TurboGears Deployment :: Apache
Next up we need to setup Apache. We're assuming Apache2 here and this is on an Ubuntu installation so the config is going to look different than some other distros.
You need to enable mod_proxy and mod_rewrite in your apache config. Use a2enmod in debian based packages of Apache.
Then we need to create our virtual host for the site. I just tacked this on to the end of the sites-available/default:
<VirtualHost *>
ServerName tg-avw
RewriteEngine on
RewriteLog /var/log/apache2/rewrite.log
RewriteRule ^/static/(.*) /home/rharding/src/tg-avw/avwsystems/static/$1 [L]
RewriteRule ^(.*) http://127.0.0.1:8080$1 [P]
AddDefaultCharset utf-8
</VirtualHost>
mod_proxy then needs to be turned on and allow proxying of content from from localhost
This is what an edited version of the debian default looks like:
<IfModule mod_proxy.c>
#turning ProxyRequests on and allowing proxying from all may allow
#spammers to use your proxy to send email.
ProxyRequests On
<Proxy *>
Order allow,deny
allow from all
Allow from localhost
</Proxy>
# Enable/disable the handling of HTTP/1.1 "Via:" headers.
# ("Full" adds the server version; "Block" removes all outgoing Via: headers)
# Set to one of: Off | On | Full | Block
ProxyVia On
# To enable the cache as well, edit and uncomment the following lines:
# (no cacheing without CacheRoot)
CacheRoot "/var/cache/apache2/proxy"
CacheSize 5
CacheGcInterval 4
CacheMaxExpire 24
CacheLastModifiedFactor 0.1
CacheDefaultExpire 1
# Again, you probably should change this.
#NoCache a_domain.com another_domain.edu joes.garage_sale.com
</IfModule>
Now if we launch our application with:
./start-avwsystems.py
We should be able to point our browser at http://tg-avw/ and get our initial application page.
software/notes/python/turbogears/apache.config.txt · Last modified: 14:41 14/07/2007 (external edit)



