[Mono-list] Mono Virtual Hosts

Andrew Arnott AndrewArnott@byu.edu
Mon, 17 May 2004 10:21:02 -0600


That makes a lot of sense.  IIS doesn't have "dedicated ASP.NET" sites,
but when an ASPX page is called for, ASP.NET kicks in and processes the
page.  However, session state must be tracked within a site, and each
site (and some subdirectories) have web.config files.  So I imagine
ASP.NET (within IIS) "discovers" ASP.NET sites as they are called for,
and caches them then. =20

It seems we could eliminate perhaps most of the special Mono commands
from the Apache configuration file.  Maybe keep one line to enable the
mono handler (perhaps at the site level).  Just let the new mod_mono
take a request for an individual page, look up the physical directory
location, scan it for web.config files, and essentially configure itself
on the fly, based on information on the virtual hosts and directories
defined in the httpd.conf file. =20

As for replacing PHP, we could run far with that idea if someone wrote a
PHP.net compiler (isn't there already one out there?) that could plug
into Mono.  Then one could remove the traditional PHP interpreter, and
all PHP code would magically become managed code that can call C# and
other code.  Ditto with Perl.

-----Original Message-----
From: Christopher McGinnis [mailto:christopherm@neopets.com]=20
Sent: Sunday, May 16, 2004 12:07 AM
To: Andrew Arnott
Subject: RE: [Mono-list] Mono Virtual Hosts

I have been kicking around of taking a serious look at mod_mono and
mod-mono-server/xsp.exe to provide better support.  Apparent the earlier
version of mod_mono hosted ASP.NET instead of mod-mono-server.exe but
had
problems with page caching because Apache kept reloading the module.  I
have
been wondering if mod_mono hosted ASP.NET and was compiled into Apache
like
PHP can be, would the problem go away?  Also, would it speed up
processing?

Essentially if mod_mono could mimic PHP by handling all ASP.NET pages no
matter what location they run from I would see no reason to use PHP
anymore.
Why use compiled byte code when your web app could be run as native
code?

Christopher McGinnis
Neopets Inc.

-----Original Message-----
From: mono-list-admin@lists.ximian.com
[mailto:mono-list-admin@lists.ximian.com] On Behalf Of Andrew Arnott
Sent: Saturday, May 15, 2004 12:23 PM
To: Jonathan Stowe; mono-list@ximian.com
Subject: RE: [Mono-list] Mono Virtual Hosts

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]
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=20
> Mono web sites, as opposed to merely virtual directories.  Here is=20
> someone's hack that supposedly fixes it.  Just wondering if it's in=20
> 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\