Search code examples
asp.net-mvcmonomod-mono

Httpd.conf multiple VirtualHost sections (was: Mono ASP.NET MVC AutoHosting issues)


I'm doing exactly this by trying to disable AutoHosting. However now I get "Failed to connect to mod-mono-server after several attempts to spawn the process." in the logs. The path is correct

Here's my config:

<VirtualHost *:80>
    ServerName myserver.com  
    DocumentRoot /home/abe/html/  
    MonoServerPath myserver.com "/usr/local/bin/mod-mono-server2"  
    MonoDebug myserver.com true  
    MonoSetEnv myserver.com MONO_IOMAP=all  
    MonoAutoApplication disabled  
    MonoApplications myserver.com "/:/home/abe/html/"  
    <Location "/">
        Allow from all  
        Order allow,deny  
        MonoSetServerAlias myserver.com  
        SetHandler mono  
    </Location>
</VirtualHost>

Fixed: see the answer below.

With the fix, though, how can I get the configuration I want w/o doing the dangerous process of editing the auto-gen'd httpd.conf?


Solution

  • Turns out this was an issue with the VirtualHost being defined twice - once in httpd.conf and once in vhosts.conf. So the fix was to use just one VirtualHost block. But this causes another problem, unfortunately. I'm in a hosted environment and httpd.conf is auto-generated so I really shouldn't be editing it directly. However it is safe to edit vhosts.conf. VirtualHost is automatically set by my host and injected into httpd.conf.