Domino & Apache?
One of things I remember hearing mentioned at Lotusphere was that the Apache web server was to be included with Domino 7. This got me quite excited. Well, I've just done some searching and found that, like most Notes developments, it's nothing to get excited about. All they are including is the Apache AXIS Web Services tool. Exciting in itself but why don't they go the whole hog and let us use Apache?
Have I got it wrong? Maybe you can use Apache with Domino. I know there are ways of configuring Apache to forward .nsf requests to Domino, which is running on a different port number. I've talked about this before. What I also found back then was that it all went wrong when Domino returned URLs to the browser and inserted the port number in to the URL, thus taking control back from Apache. My understanding was that Domino 7 might eliminate this. Oh well...
The reason it's back in my mind is that I'm playing with LAMP again. As ever, I am constantly learning new things and even learning new approaches to others. Last week I discovered a better way to create user-friendly URLs. Consider the following URLs:
- www.jakehowlett.com/gallery/
- www.jakehowlett.com/gallery/archive/35.html
- www.jakehowlett.com/gallery/archive/2004/2/
All three URLs are handled by one PHP file called index.php. The reason this works is that Apache can pattern-match incoming URLs and point them to the right place. Here are the rules needed. All you need to do is place them in a text file called .htaccess and place it in the folder your web server.
RewriteEngine on
RewriteBase /gallery/
RewriteRule ^archive/([0-9]+).html$ index.php?photo=$1
RewriteRule ^archive/(.*)/(.*)/$ index.php?year=$1&month=$2
And, to prove the point, here's the URLs of the real locations:
- www.jakehowlett.com/gallery/index.php
- www.jakehowlett.com/gallery/index.php?photo=35
- www.jakehowlett.com/gallery/index.php?year=2004&month=2
It would be great to be able to do this in Domino 7. No more ugly URLs.
What a coincidence...I just started learning mod_rewrite the other day (not by choice!). It can be a bear, but it's very powerful once you learn the basics. I had to tweak the Apache config file a bit to get it to work, so it may not be as simple as just creating a .htaccess file in everyone's case.
Hey Jake,
I was reading through the Tomcat configuration example that ships with Tomcat this past weekend. There is something called the JK2 connector, written in java, based on an appache.org object, that allows Tomcat to connect to Apache and vice-versa. It appears to be a pretty well established standard connector topology. Seems like any diligent java programmer with some Apache experience could make one that works from any existing domino server with a JVM running.... I'd be curious to know if it were possible. Certainly seems so.
It works with Tomcat because it uses connectors. You can't use a connector (coyote, jk2 or other) with something else than Tomcat.
You can to some extent do this with Substitution Rules in Domino 6. For example I have rules similar to:
/*/*.html => /*.nsf/docs/*
It's not as flexible as mod_rewrite, for example you can't re-order parameters or use regexps to filter input, but it seems to work okay. Hmm.. maybe an idea for a DSAPI filter plugin.. :)
There is the "Domino Tomcat Redirector" {Link} that allows Domino to use Tomcat as it's servlet/JSP server.
Re: nice URLs, the website I look after at {Link} is a domino one and has loverly URLs. All done with URL substitution rules in Domino.
I'm a big fan of readable URLs and hate teh standard Domino ones. The webspere portal server URLs are an abomination!!!!
Just for clarification. Apache was already promised for Domino 6. The statement was made while the Garnet story upset many by Mr. Arthur Fontaine.
{Link}
At the end both were gone without further notification. I still have hope for Domino 7 though.
Have a nice day.
Heini