[Mono-aspnet-list] Problems configuring apache2 + mono

Daniel J. Summers daniel.summers.2415 at gmail.com
Tue Mar 29 09:19:04 EDT 2011

On Tue, Mar 29, 2011 at 11:16 AM, Francisco M. Marzoa Alonso <
francisco at marzoa.com> wrote:

> I get the following message on /var/log/apache2/error.log
> "Failed to connect to mod-mono-server after several attempts to spawn
> the process."

> > But when I create a mono aplication on /etc/mono-server2/ it does not
> > run as expected. I've created one file called fake.domain.com.webapp
> > with the following contents:

I have had little success trying to get the .webapp files working.  (Maybe
someone can chime in and enlighten me too!)  As a shot in the dark, try
putting "MonoSetServerAlias default" in your location config.  However, I
have gotten it to work using two different processes.

The first results in a mono server process for each domain.  The upside to
this is that each domain is free to serve pages from different server
instances; the downside is that you use a good bit more memory.  To do this,
I use a virtual host config similar to this one:

<VirtualHost *:80>
  ServerName   djs-consulting.johnson
  DocumentRoot /var/www/dev/djsconsulting

  # Mono config
  MonoDebug         djs  false
  MonoSetEnv        djs  MONO_IOMAP=all
  MonoServerPath    djs  /usr/bin/mod-mono-server2
  MonoApplications  djs

  <Directory /var/www/dev/djsconsulting>
    MonoSetServerAlias djs
    SetHandler mono

The second parameter to the Mono statements give it a server alias; then, in
the Directory directive, I tell it to use that server alias.

The other way (and the way I'm running on my production web server) uses
just one Mono server instance to serve many domains.  Since Apache controls
the spawning of it, I really don't know how I'd "restart" just one domain.
 To do this, I have the following in

<IfModule mod_mono.c>
  MonoUnixSocket default /tmp/.mod_mono_server4
  MonoServerPath default "/opt/mono-2.10/bin/mod-mono-server4"
  AddType application/x-asp-net .aspx .ashx .asmx .ascx .asax .config .ascx
  MonoSetEnv default
  MonoApplications default

(A side note - I'm running a compiled-by-me version of Mono 2.10; if you're
using 2.8 or earlier, the MonoUnixSocket and MonoServerPath should point to
*-server2, and you won't need the MonoSetEnv directive past the word "all".)

Then, as an example, the vpr.johnson virtual host file looks like this:

<VirtualHost *:80>
  ServerName   vpr.johnson
  DocumentRoot /var/www/dev/vpr

  <Location "/">
    SetHandler mono
    SetOutputFilter DEFLATE
    SetEnvIfNoCase Request_URI "\.(?:gif|jpe?g|png)$" no-gzip dont-vary
  <IfModule mod-deflate.c>
    AddOutputFilterByType DEFLATE text/html text/plain text/xml

("johnson" is my development machine, and I've set aliases in /etc/hosts
that point things like vpr.johnson to - it keeps the virtual
structure the way it runs in production.)

Like I said above, this second way is the configuration I'm using on the
server that is actually serving the content, and it's working great.  I
would like to see if I could make the .webapp version work, but for now,
I've found that the latter config meets my needs, and it's the same
complexity as the FastCGI config I used to run, so at least it's no more
complex.  :)

*Daniel J. Summers*
*Owner, DJS Consulting*
E-mail <daniel.summers.2415 at gmail.com> • Website <http://djs-consulting.com>
 • Support <http://support.djs-consulting.com> • Tech

GEEKCODE 3.12 GCS/IT d s-:+ a C++ P--- L++ E--- W++ N++ o? K- w !O M--
V PS+ PE++ Y? PGP- t+ 5? X+ R* tv b+ DI++ D+ G- e<++ h---- r+++ y++++
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-aspnet-list/attachments/20110329/28664ca4/attachment-0001.html 

More information about the Mono-aspnet-list mailing list