[Mono-list] Multiple ASP.net VirtualHosts, running as `/'
Steve Deobald
steve@citygroup.ca
Sun, 13 Jun 2004 22:06:10 -0600
On Fri, 2004-06-11 at 01:38, Gonzalo Paniagua Javier wrote:
> You don't need the alias for / if you use DocumentRoot
> (http://httpd.apache.org/docs-2.0/mod/core.html#documentroot) and then
> <Location />
> SetHandler mono
> </Location>
>
> and, btw, then ending / after all public_html you have might be wrong.
>
> -Gonzalo
Hey folks! After a long chat with Gonz before the weekend, I found out a
lot of neat mod_mono/xsp stuff relating to running multiple VirtualHosts
with different methods.
Briefly, for myself, the easiest solution was to go with a single
`MonoApplications' line:
MonoApplications
"someguy.com:80:/:/home/someguy/blah,otherguy.com:80:/:/home/otherguy/public_html"
Keep this outside of your <VirtualHost> directive, and all should be
well. (If you only need one vhost running, just use everything up to the
comma.) Your <VirtualHost> directive will now look something like:
DocumentRoot /home/someguy/public_html
<Location />
SetHandler mono
</Location>
I think this is gorgeous. Nice and clean - easy to edit. Congrats to the
mod_mono/xsp team on this. Gonzalo also mentioned to me that if one is
looking to script vhost creation, it's easiest to use .webapp files.
I'll look into this further, but I'm happy with the current solution for
myself.
I'm pasting the modified chat log from talking with Gonz below.
Hopefully someone coming across this while Googling will find it useful.
:) If anyone has any corrections or amendments, please reply to this
thread. Thanks!
.steve
16:03 < steved> gonzalo: Hmm. I changed my server config as you
suggested (use DocumentRoot exclusively with the Location directive),
but somehow all traffic is still redirected to a single site.
16:03 < steved> gonzalo: Any ideas?
16:03 <@gonzalo> no :-?
16:04 < steved> dohs
16:04 < steved> Any idea if anyone else has this working? Cuz if so,
I'll keep playing with it.
16:04 < steved> Just curious if it's a bug
16:05 <@gonzalo> looks more like a configuration problem
16:05 < steved> gonzalo: okay
16:05 <@gonzalo> either on apache side or mod-mono-server side (might
even be a bug)
16:06 < steved> gonzalo: This is all that's in there right now (followed
by the regular stuff):
16:06 < steved> DocumentRoot /home/mdevelop/public_html
16:06 < steved> MonoApplications "/:/home/mdevelop/public_html"
16:06 < steved> <Location />
16:06 < steved> SetHandler mono
16:06 < steved> </Location>
16:06 < steved> I don't really know the internals of Apache (this is
1.3), so I'm not sure why all the following sites would also point to
that same location
16:07 <@gonzalo> steved: that's not the way to go for virtual servers
16:07 < steved> gonzalo: oh?
16:07 <@gonzalo> you need to use a .webapp file
16:07 < steved> Ahh!
16:07 < steved> I didn't realize it was required.
16:07 <@gonzalo> man mcs or man mod_mono
16:07 < steved> Okay, cool.
16:07 <@gonzalo> or change MonoApplications to include the virtual
server too
16:07 < steved> I was just trying to make it as simple a config as
possible. :)
16:08 < steved> Change MonoApplications to include the virtual
server...?
16:08 <@gonzalo> a comma separated list of virtual directory and
16:08 <@gonzalo> real directory for all the applications we want to
manage
16:08 <@gonzalo> with this server. The virtual and real dirs. are
separated
16:08 <@gonzalo> by a colon. Optionally you may specify virtual host
name
16:08 <@gonzalo> and a port.
16:08 * gonzalo notices the man page is not updated
16:09 <@gonzalo> [[hostname:]port:]VPath:realpath
16:09 < steved> ah
16:10 < steved> MonoApplications
"monodevelop.com:80:/:/home/mdevelop/blah"
16:10 < steved> And then the .webapp file isn't required, or?
16:11 <@gonzalo> right
16:11 < steved> Cool stuff
16:12 <@gonzalo> i will add some more docs and release xsp and mod_mono
16:12 < steved> So can the "detailed" MonoApplications format and
.webapp files be mixed? (cleanly?)
16:12 <@gonzalo> yes
16:12 < steved> Also cool
16:12 <@gonzalo> it doesn't handle duplicates, so watch out
16:12 < steved> Come again?
16:12 <@gonzalo> if you give an application in MonoApplication and then
16:13 <@gonzalo> another on with the same server/port/vdir, the second
one overwrites the first one
16:13 < steved> Ah, ok
16:13 < steved> That's fair enough, I think ;)
16:14 < steved> So if I avoid .webapps, should I only have a single
MonoApplications line in the whole config file?
16:14 < steved> As opposed to putting it in the VirtualHost directive?
16:14 < steved> s/the/a
16:15 < steved> Or rather, does it require a single comma-delimited
MonoApplications directive, or can multiple be used?
16:16 <@gonzalo> one single --applications
16:17 <@gonzalo> once you make it work, can you post a reply to the
list?
16:17 * steved answers his own question with an experiment
16:17 < steved> Yeah, for sure
16:17 < steved> This is really cool
16:17 <@gonzalo> thanks!
16:17 < steved> Cuz
16:17 < steved> I just tried multiple lines, and that works fine
16:18 <@gonzalo> oh
16:18 <@gonzalo> hahaha
16:18 < steved> :)
16:18 < steved> Although it works weird.
16:18 <@gonzalo> i'll document that 'feature' :)
16:18 < steved> hahah!
16:18 <@gonzalo> or make it not work at all
16:18 < steved> Heh
16:18 < steved> Both are good, I guess. ;)
16:18 < steved> It's kinda nice this way, actually
16:18 < steved> Seems more intuitive to me, for some reason.
16:19 < steved> However, it does make it operate really specifically.
16:19 <@gonzalo> i prefer that instead of the .webapp
16:19 < steved> Compare www.monodevelop.com and monodevelop.com right
now, and it only works w/o the www.
16:19 <@gonzalo> but if you want to serve $HOME/public_html dirs,
16:19 <@gonzalo> it's better to use .webapp
16:19 <@gonzalo> as you can make then with a script and deploy all of
them in a directory
16:19 < steved> Any particular reason?
16:20 < steved> Oh, I see
16:20 < steved> Put the .webapp in people's skel, you mean?
16:20 <@gonzalo> no, you put all of them in a directory
16:20 <@gonzalo> and then use --appconfigdir
16:20 < steved> oh
16:20 <@gonzalo> or the equivalent mod_mono stuff
16:20 < steved> Right
16:21 < steved> But just for the ease of scripting, you're saying
16:21 <@gonzalo> yes
16:21 < steved> I guess that make sense
16:21 <@gonzalo> one of these years i'll have a proper FAQ containing
hints on this
16:21 < steved> Man, this is awesome
16:21 <@gonzalo> :)
16:21 < steved> hehe :)
16:21 < steved> Well, I'm slowly building up one of my own. ;)
16:22 < steved> Definitely cool to find out about all the options. The
flexibility is really nice.
16:23 <@gonzalo> jaroslaw did a good job with vhost support in xsp
16:23 < steved> yeah?
16:23 <@gonzalo> he did most of the patch
16:23 <@gonzalo> that added vhost support through --applications or
.webapp files
16:24 < steved> If I continue to use multiple MonoApplications
directives (assuming you leave that "feature" in), is there a way to set
wildcards at all? Or do I just have to be very specific about what to
run mono on?
16:24 < steved> ie. Can I say *.monodevelop.com? or just monodevelop.com
and www.monodevelop.com?
16:24 <@gonzalo> the wild card for hosts is having no host at all
16:24 <@gonzalo> for the rest, there's no wildcard
16:25 < steved> gonzalo: ok
16:26 < steved> gonzalo: So can I do that with .webapp (have
*.monodevelop.com handled by mod_mono)? Or it's just not available if I
want multiple virtual hosts?
16:43 < steved> gonzalo: oops, I take it back
16:43 < steved> You can't have multiple MonoApplications lines
16:43 < steved> It looked like it worked, but I guess it doesn't :)