One Server with PHP and Domino
Until now I had assumed the only way to get Domino and PHP to run on the same server was to run one of them on a different port. This approach has been documented a few times already and hinges on running Domino on port 81. It works well until you start submitting forms and using authentication. At this point Domino starts adding the :81 to the URL and the browser thinks you need to login again.
Not happy with this approach I had opted to only running the server I wanted to develop with on any particular day. Then, this weekend, I hit upon an idea. Why not assign the server two IP addresses and two host names? Domino can run on one, PHP on the other. What surprised me was how easy it was to do this. Here's an abridged how-to.
First thing to do is add another network device to the server (I'm using Redhat 9). Not a new card, just a new "device" that runs on the same network card. Open the Network Config panel and add a new device. Give it a static IP that's different to the IP the server currently uses. My dev server was running on 192.168.0.50 so I added the new device as 192.168.0.51. This, in effect, creates the illusion of there being another server on the network.
I am going to run Apache on this IP address, so I open the HTTP Server Settings dialog and tell it what IP address to listen on, as below:
Domino is going to run on the original IP address. All I need to do is tell it to only run on this address by binding it to it. In the Server Document make sure this is enabled, as below:
Notice how some of these settings rely on host names rather than IP addresses? We also need to make DNS changes. Originally my domain's DNS records had one IP address (.0.50) registered for both the "php" and the "domino" hosts. All I had to do was edit the php host record to point to (.0.51).
So far, everything works really well. It really does feel like I've got a free server! Why share this with you? Well, I know I'm not the only one with an interest in both PHP and Domino and with their own server to play with. As with everything else I share I just hope it's of use to some of you...
What are the advantages of using Linux as a development server, rather than windows. Should I migrate, Where can I get Linux from???
How clever!
I wonder if this would work under Windows 2k/XP? Where you add a TCP/IP protocol, I presume.
This is so much cleaner than the ports solution.
This is a similar solution to one I posted a few years back to run IIS and Domino on the same server & port 80. Back then we have a http.cfg file to contend with, bind to host in the server document made thing much easier. Jake thanks for sharing this, I don't recall ever seeing this in the print media, I don't know why this is great for small shops tht develop on more than just Domino.
Sorry, hit post before I answered Dave's question, Yes!!, this will work with NT/2000/XP.
Interesting and simple.
As a system administrator this was so obvious I wondered why nobody knew this already :-)
But then in the servers I used to work with there are always multiple IP-addresses and multiple network cards available, so I never considered this as to not be obvious.
I have another question though.
Would you know of an easy way to host php pages on a domino server where there is no other web server present?
If you need everything to be hosted on the same domain, for example this would be a very good solution.
Jean Marie. Nothing like this is obvious to us lowly developers ;o)
You can run PHP as a .exe on any web server (I think) but it's not advisable from a security POV.
Personally I like to keep Domino alone. It doesn't play well with the other kids!
LOL.
I'm an administrator turned developer, so I have a good understanding of both sides, which does give me an advantage in development as well. Since I can remember a lot of the pitfalls from my administrator days, I tend to look at this when I'm developing.
I know it's possible to have the php.exe somewhere and then call it to host the pages, but I haven't find an elegant (and secure) solution for it yet.
If ever I do, I'll let you know !!
Jake,
What tool do you use to edit the configuration of the apache server ? It seems easier than editing the httpd.conf file...
And have you ever tried to configure SSL (https) for multiple named based virtual hosts ? apparently only possible using multiple IP...
Thanks,
Gaston
Gaston. It's the standard "HTTP Server Settings" panel that comes with Redhat 9.
Not an SSL expert by any means.
Jake,
I have 3 servers running on one box, one IP, and these include both Apache and Domino together. I do not get the port 81 added by Domino at any point, I think this is because I do not rewrite URLs, I proxy them. This is very simple to implement. I have explained it in this article:
{Link}
However, I think your solution is more elegant and better separates web servers from each other. Thanks for sharing this!
Has anyone tried using Websphere as the HTTP server for Domino, or has that offer been retracted by IBM? In R6 they included a restricted Websphere license to use WS as the HTTP server. In theory... since Websphere is really Apache, this might fix some of the Domino-centic web issues. I had IBM Global Services in to do a domain upgrade and asked them about this and none of them knew how to do it. Seems that the Notes and WS groups don't speak to each other.
Ed - Search for "IBM HTTP" in the R6 Admin help. It has all the information you need to setup IHS (ie. the web server Websphere uses) to talk to Domino via a plugin.
Gaston: SSL is not possible on name based virtual hosts, only on IP based hosts, because the Host: header passed in during the connection is encrypted and cannot be decrypted by the web server in order to determine which host to actually send it to. Catch 22.
You can run PHP as an exe and setup a url->directory redirect document, with the choice to 'execute'.
Then anything with a *.php extension will be processed by php, and everything else by domino - easier than the 2 port solution and no need for apache or iis if you are using the domino stack.
as jake said tho - might by a tad insecure this way.
Admin Help (R5) has some information on this multi-homing also (search for "Assigning separate IP addresses with a single NIC"), including command line info on HP-UX and AIX which might be of some use for those who run macho Linux servers ;-)
Jake,
I'm thinking of following your lead and jumping into Linux -- but I'm wondering if there is any downside to using the workstation (i.e. Redhat 9) versus the server kernel (Enterprise v.3).
Thanks
You're asking me Patrick? I didn't even know there was a difference ;o)
Patrick, you might want to look at IBM's hardware requirements for Domino 6 and 6.5:
{Link}
{Link}
RH9 is not officially supported. I've installed R5 on remote, non-GUI RH 7.2 servers with no problem. If you are only going to be tinkering with a development server, then I think you should try it on whatever distro you find easiest to use (I found R5 also worked fine on every version of Mandrake I tried.)
Incidentally, Jake. Do you find that @Environment works on Linux? I find I can get and set the env vars through the server console, and through configuration docs, but trying in formulas or Lotusscript just doesn't work.
Sorry Bernard, I don't use environment variables, as a rule, so don't know.
Installing a reverse proxy is the way to go. This can also handle the SSL connections too, so your web servers don't have to each be set up for SSL. It also provides some network performance benefits as well since the proxy buffers the http transaction meaning the web server spends less time in network IO.
The one we ship with Puakma is written in Java so runs on any platform too.
{Link}
Brendon.
I have used this process for a number of years -- ever since Domino was ported for Linux servers. Previously I used Apache's ability to do a proxypass. I was shocked to learn that I could also authenicate without major problems -- this was the R5 world.
With two web servers (apache and domino each with unique ip addresses), I can share content as well as long as I have domino connect to MySQL.
just my 2 pense worth.....
i want to use that same configuration except for apache. i need IIS (running on win2003 server). i can see that domino (r6) is binded to one IP (not for second one) but when i start IIS (on second ip) it gives me an error, telling that port is already use! when i stop domino and start iis again it works fine (serving only on second ip). any glue on that?
moyses
Moyses: read this:
{Link}