mod_mono - apache module that enables ASP.NET pages. Works together with
is a simple module that works with Apache 2.0 or newer.
It needs mod-mono-server.exe installed on the system. By default, it will attemp
to run mod-mono-server.exe if it doesn't find it's running.
All the directives but MonoSetServerAlias accept an optional first argument that
is the mod-mono-server instance alias for which the directive applies. If only
one argument is provided for them, thr directive will apply to the 'default'
mod-mono-server instance. Refer to the monodoc documentation on configuring
mod_mono for more examples.
- It accepts an octal number as a parameter. The number must
be a valid unix file creation mask value (see umask(2)). The mask will be
applied whenever a directory or file is created from within an ASP.NET
application. Default value: "0077".
- It accepts a file name as argument. That file will be a
named pipe used to send/receive data from/to mod_mono to/from
mod-mono-server. You cannot use MonoListenPort and MonoUnixSocket at the
same time. Default value: "/tmp/mod_mono_server".
- TCP port on which mod-mono-server should listen/is
listening on. Mutually exclusive with MonoUnixSocket. When this options is
specified, mod-mono-server and mod_mono will use a TCP socket for
communication. Default value: none
- MonoListenBacklog N
- The backlog of connections to set on the listener socket in
mod-mono-server. By default the value is set to 500.
- MonoMinThreads N
- The minimum number of threads the threadpool allocates in
mod-mono-server. Increase this value to better handle the sudden arrival
of connections. The default value is determined by the mono runtime.
- IP address where mod-mono-server should listen/is listening
on. Can only be used when MonoListenPort is specified. Default value:
- If the value is True, it tells mod_mono to spawn
mod-mono-server.exe if it's not already running. If set to False, most of
these directives are useless. Default value: True
- Number of times mod_mono will attempt to start a backend
which died. Value cannot be lower than 0. Default value: 3
- Number of seconds to wait after starting the backend. This
is to let the backend initialize properly before attempting to connect to
it. Value cannot be lower than 2. Default value: 2
- Set the auto-restart mode for the backend(s). Three modes
are available: None - do not auto-restart, Requests - restart after a
configured number of requests served, Time - restart after the backend has
been up for the specified period of time. Note that if you enable
auto-restart you should consider using off-process state server, since on
every restart your application state will be lost. Default value:
- Number of requests for a backend to serve before
auto-restarting. The value here is taken into account only when
MonoAutoRestartMode is set to Requests. Default value: 10000
- Time after which the backend should be auto-restarted. The
time format is: DD[:HH[:MM[:SS]]]. Default value: 00:12:00:00
- MonoExecutablePath (Obsoleted, ignored)
- Don't use this. It is ignored and has been left here for
compatibility purposes. Default value: "/usr/bin/mono"
- This value will be used to set the MONO_PATH environment
variable. Default value: ""
- The full path to the mod-mono-server script. Default value:
- If MonoRunXSP is True, this option selects the .NET
framework version to use. This affects the backend that is started to
service the requests. The MonoServerPath option takes precedence over this
setting. Available values are "2.0", "3.5" and
"4.0". Default value: "2.0"
- The directory where mono runtime will create the
".wapi" directory used to emulate windows I/O. It's used to set
MONO_SHARED_DIR. Default value: "/tmp"
- The directory passed in --root argument when launching
- If MonoRunXSP is True, CPU time limit in seconds allowed
for the spawned mono process. Beyond that, it will be restarted. If this
capability is not available on your system, the directive will be ignored.
Default value: system default
- If MonoRunXSP is True, the maximum size of the process's
data segment (data size) in bytes allowed for the spawned mono process. It
will be restarted when the limit is reached. If this capability is not
available on your system, the directive will be ignored. Default value:
- This value will be passed to mod-mono-server.exe in the
--applications option. See xsp(1) manual page for details.
- The argument passed in --appconfigfile argument to
mod-mono-server. Default value: NULL.
- The argument passed in --appconfigdir argument to
mod-mono-server. Default value: config/mod-mono-applications
Note that you must specify at least one of MonoApplications,
MonoApplicationsConfigFile and MonoApplicationsConfigDir.
- Enables or disables automatic ASP.NET applications
discovery. By default it is enabled if you have no application configured.
Otherwise, it's disabled. The possible values are 'enabled' or
- Runs mono in debug mode, which produces stack traces with
line numbers. Default value: False.
- Takes a server alias name. This is to be used inside
<Directory> or <Location>. Default value: 'default' if the
directive is not used.
- Takes a string of 'name=value' pairs separated by
semicolons. For each pair, it calls setenv (name, value) before running
- Takes alias name and a string of the same format and
meaning as the MONO_IOMAP environment variable (see the mono(1) manpage).
The effect is that mod_mono performs the same actions as mono runtime with
MONO_IOMAP in effect, as well as that the MONO_IOMAP variable with the
specified value is exported in the backend environment. This option is
necessary when you're using MONO_IOMAP in your application and there might
be static files with mixed case names - in such case mod_mono attempts to
open the file directly and sends it using apache facilities. Default
- The maximum number of concurrent requests mod_mono will
pass off to the ASP.NET backend. Set to zero to turn off the limit.
Default value: 0.
- The maximum number of concurrent requests mod_mono will
hold while the ASP.NET backend is busy with the maximum number of requests
specified by MonoMaxActiveRequests. Requests that can't be processed or
held are dropped with Service Unavailable. Default value: 150.
- Do not protect hidden files/directories from being accessed
by clients. Hidden files/directories are those with Hidden attribute on
Windows and whose name starts with a dot on Unix. Any file/directory below
a hidden directory is inacessible. This option turns the default behavior
of protecting such locations off. If your application does not contain any
hidden files/directories, you might want to use this option as the
checking process has a per-request cost. Accepts a boolean value - 'true'
or 'false' Default value: true. AppSettings key name:
Note that the configuration below requires the mod_mono module to be loaded by
Apache. How it is done is distribution-specific - please check your
distribution documentation for details.
This one using <Directory>:
Alias /mono "/usr/lib/xsp/test"
AddMonoApplications default "/mono:/usr/lib/xsp/test"
This one using <Location>:
Alias /demo "/usr/lib/xsp/test"
AddMonoApplications default "/demo:/usr/lib/xsp/test"
If you prefer to .webapp configuration file(s) (see manual page of xsp), you can
change MonoApplications in the above samples by:
MonoApplicationsConfigFile default "/var/www/applications.webapp"
replacing the path to the file with yours.
If you want to use several .webapp files, use this instead:
MonoApplicationsConfigDir default "/var/www/webapp"
and all the .webapp files found in the directory /var/www/webapp will be loaded.
Refer to monodoc documentation on configuring mod_mono for more examples.
mod_mono provides a simple web-based control panel for restarting the
mod-mono-server, which is useful when assemblies need to be reloaded from disk
after they have been changed. To activate the control panel, place the
following in your httpd.conf:
Deny from all
Allow from 127.0.0.1
The control panel is then accessible at http://yourdomain.com/mono. Clicking the
link to restart mod-mono-server will immediately restart it.
The Order/Deny/Allow access controls above restrict access to the control panel
to the computer with IP address 127.0.0.1. Replace this (or add more Allow
lines) with the IP address of your own computer so that you can access the
control panel. You can also use Apache's htaccess features to password protect
It may modify MONO_PATH, PATH and MONO_SHARED_DIR when starting mod-mono-server.
The MOD_MONO_CCV variable may be used to select which component will do client
certificate validity (CCV) checks. By default both Apache and Mono will verify
the client certificates. This can be changed to either "apache" or
"mono" to limit the validity check to either environment. This
variable can be set using MonoSetEnv to allow different vhost to use separate
The MOD_MONO_LOCKING_MECHANISM variable may be used to choose the APR locking
mechanism for the dashboard. The currently defined mechanism names are:
DEFAULT, FCNT, FLOCK, SYSVSEM, PROC_PTHREAD, POSIXSEM. Note that not every
mechanism may be available for your platform. In such case, mod_mono will
fallback to using the DEFAULT value which lets the APR decide which locking
mechanism to use. DEFAULT is also the default value for the option if the
environment variable is not set or its value is unknown. This value MUST
be set using MonoSetEnv - it MUST
be present in the Apache
environment before the module is initialized and its configuration parsed.
mod_mono was started by Daniel Ridruejo (daniel rawbyte com). Currently, Marek
Habersack (email@example.com) is the maintainer.
See http://mail.ximian.com/mailman/mono-list for details.
Visit http://mono-project.com/Mod_mono for details.