Sunday, 11 September 2005
Blojsom and Apache Virtual Server
As Blojsom is a Java web app I needed a Java web server, and being very familiar with Tomcat I chose to use that server (currently 5.5.9). The machine that hosts this blog is running Apache and I can't remove Apache just to run Tomcat so I had to get them both working together
The simplest solution was to use mod_proxy and just for giggles I decided to go with the VirtualHost approach. I found this Document and used that as the basis for setting up my server. Initially my VirtualHost entry looke like this
NameVirtualHost *:80
<VirtualHost *:80>
ServerName blogs.advantaje.com
ProxyRequests Off
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyPass / http://localhost:8081/blojsom/
ProxyPassReverse / http://localhost:8081/blojsom/
ErrorLog /etc/httpd/logs/blogs_error.log
LogLevel warn
CustomLog /etc/httpd/logs/blogs_access.log combined
</VirtualHost>
i.e. forwarding any call to http://blogs.advantaje.com to http://localhost:8081/blojsom/
However this failed when I tried to adminsiter the site. I kept getting asked to log-in whenever I tried to perform any administrative task, so I'd log in, try the task again and be asked to login,a nd go round and round that loop!
In the end I went with a different solution. I create another instance of Tomcat, made Blojsom the default (ROO) app, changed the ports in TC from the default values and changed the VirtualHost to look like
NameVirtualHost *:80
<VirtualHost *:80>
ServerName blogs.advantaje.com
ProxyRequests Off
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyPass / http://localhost:48081/
ProxyPassReverse / http://localhost:48081/
ErrorLog /etc/httpd/logs/blogs_error.log
LogLevel warn
CustomLog /etc/httpd/logs/blogs_access.log combined
</VirtualHost>
Blojsom's happy and I'm happy!
Posted by at 11:39 PM in General
