[Mono-aspnet-list] Is this a serious flaw or just my mistake?

Marek Habersack grendel at twistedcode.net
Mon Aug 17 08:13:24 EDT 2009


Batchwood wrote:
> 
> Diego Frata wrote:
>> Try setting the configuration for each virtual host instead using the
>> mod_mono.conf.
>>
>> Eg:
>>
>> <VirtualHost *:80>
>>   ServerName my-mono-site.com
>>   ServerAdmin web-admin at my-mono-site.com
>>   DocumentRoot /srv/www/my-mono-site.com
>> *  MonoServerPath my-mono-site.com "/usr/bin/mod-mono-server2"
>>   MonoSetEnv my-mono-site.com MONO_IOMAP=all
>>   MonoApplications my-mono-site.com "/:/srv/www/my-mono-site.com"
>> *  <Location "/">
>>     Allow from all
>>     Order allow,deny
>> *    MonoSetServerAlias my-mono-site.com*
>> *    SetHandler mono*
>>     SetOutputFilter DEFLATE
>>     SetEnvIfNoCase Request_URI "\.(?:gif|jpe?g|png)$" no-gzip dont-vary
>>   </Location>
>>   <IfModule mod_deflate.c>
>>     AddOutputFilterByType DEFLATE text/html text/plain text/xml
>> text/javascript
>>   </IfModule>
>> </VirtualHost>
>>
>> Diego Frata
>> diego.frata at gmail.com
>>
>>
> 
> thank you for your response, Diego. I tried for many hours to make this work
> with no luck. It appears that virtual hosting is not possible in mono.
It is of course possible (and used heavily by us at Mono as well as on quite a few websites). In 
your original post you don't say why apache doesn't start. This suggests an error, errors are logged 
in apache's error.log. Mod_mono itself has nothing to do with virtual hosting, it's just a module 
which passes requests to an _application_ running in background, with said application again having 
nothing to do with virtual hosting. So the error is not related to virtual hosting, but rather to 
some misconfiguration of Apache (which might, of course, be related to Mono). Until you give us more 
info on what errors are in apache's error log, we can't tell much about the causes. I think you 
should start by going to http://go-mono.com/config-mod-mono/ and generating valid mod_mono 
configuration.

> Therefore, unfortunately, it's back to PHP where I know that virtual hosting
> works in native Apache. This is really too bad because ASP.net is so much
> cleaner than PHP. 
You seem to be a bit confused about how mod_mono works. The apache side of it (the mod_mono.so 
module) is almost no different than PHP. The difference is that as long as PHP (in most 
installations) is embedded in the shared module, mod_mono is not embedding the Mono runtime but 
rather passing the requests along to a backend process which then executes the request within the 
application. Each virtual host corresponds (roughly) to a single backend process. And, once again, 
neither mod_mono or Mono runtime deal with virtual hosting. mod_mono looks at and selects backends 
to service a request by looking at the server alias (the one set with MonoSetServerAlias).

marek


More information about the Mono-aspnet-list mailing list