[Mono-list] Mono Virtual Hosts

Andrew Arnott AndrewArnott@byu.edu
Sat, 15 May 2004 13:22:35 -0600


This is a multi-part message in MIME format.

------_=_NextPart_001_01C43AB1.FB2A1D76
Content-Type: text/plain;
	charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

This is a patch for mod_mono 0.9 to enable ONE virtual host.
Specifically, mod_mono 0.9 does NOT pass MonoServerRootDir from the
Apache configuration file on to mod-mono-server.exe.  This patch makes
it actually pass it on so that a virtual host's configuration can work
and pages can be served. =20

There is still the issue of multiple virtual hosts.  Trouble is,
mod-mono-server.exe takes only one "-root" command, so if you have
several virtual hosts in Apache and they all have their own root
directory, then mod_mono launches mod-mono-server.exe with the root
directory of the virtual host that is requested first.  After that, the
next virtual host requested by a browser "re-uses" the existing instance
of mod-mono-server.exe and the original web site comes up instead of the
one called for. =20

Has anyone written code to fix this?  Since it's not in CVS yet, if a
patch is available can they post it so we can try it out?  I would write
it, but I'm afraid I know C# much better than I know how to write apache
mods.  Speaking of which, I heard of a project to expose Apache APIs to
Mono.  What about rewriting mod_mono using C# itself when it's time?
Any takers?

I have taken the patch written by Christopher McGinnis and improved it
slightly (corrected some help strings and made it a little cleaner).  I
have attached it to this email.

-----Original Message-----
From: Jonathan Stowe [mailto:jns@gellyfish.com]=20
Sent: Wednesday, May 12, 2004 10:55 AM
To: Andrew Arnott
Cc: Mono-List
Subject: Re: [Mono-list] Mono Virtual Hosts

On Wed, 2004-05-12 at 17:30, Andrew Arnott wrote:
> Does CVS fix the Virtual Hosts problem yet?  I want to host multiple
> Mono web sites, as opposed to merely virtual directories.  Here is
> someone's hack that supposedly fixes it.  Just wondering if it's in
> CVS yet.

It's not in the CVS no. I would guess that posting a patch on a bulletin
board is not a particularly efficient way of getting it applied :-)

/J\




------_=_NextPart_001_01C43AB1.FB2A1D76
Content-Type: application/octet-stream;
	name="mod_mono-0.9-virtualhost.patch"
Content-Transfer-Encoding: base64
Content-Description: mod_mono-0.9-virtualhost.patch
Content-Disposition: att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