ASP.NET MVC under Linux with Mono

Setup Mono on your Linux server

1. Install mod_mono

sudo apt-get install libapache2-mod-mono mono-apache-server4

2. Configure mod_mono

sudo nano /etc/apache2/mods-available/mod_mono.conf


AddType application/x-asp-net .aspx .ashx .asmx .ascx .asax .config .ascx
DirectoryIndex index.aspx

# Include the web application definitions generated by mono-server{2,4}-update.
# If you want to use ASP.NET 2.0 (via mono-apache-server2), use:
# Include /etc/mono-server2/mono-server2-hosts.conf
# If you want to use ASP.NET 4.0 (via mono-apache-server4), use:
# Include /etc/mono-server4/mono-server4-hosts.conf

Include /etc/mono-server4/mono-server4-hosts.conf

3.  Setup your Virtual Host

Prepare your public directory

mkdir /home/alduin/www

Make your directory readable by Apache

sudo chown -R www-data:www-data /home/alduin/www

Create apache configuration file



ErrorLog /var/log/apache2/
CustomLog /var/log/apache2/ combined
DocumentRoot /home/alduin/www/
 MonoServerPath "/usr/bin/mod-mono-server4"
 MonoDebug true # disable it in production
 MonoApplications "/:/home/alduin/"

<Location "/">
 Allow from all
 Order allow,deny
 SetHandler mono
 SetOutputFilter DEFLATE
 SetEnvIfNoCase Request_URI "\.(?:gif|jpe?g|png)$" no-gzip dont-vary

 AddOutputFilterByType DEFLATE text/html text/plain text/xml text/javascript

4. Restart Apache

sudo service apache2 restart

Upload your ASP.NET MVC application

1. Stuff you need to upload:

bin – all dlls
public – css, js
Views – all razor files

ASP.NET MVC under Linux with Mono

Also you should upload these dlls to bin directory:



Here is an example of fully functioning website done using ASP.NET MVC 3:

You may also like...

  • Pingback: xovilichter()

  • Pingback: top plumber in Austin TX()

  • Matt

    Is it possible to run mvc 4 or mvc 5??

    • R2D2

      I haven’t tried it yet. But I will try to get some demo running this weekend.

    • R2D2

      Yes you can, both actually.

  • Pingback: buy mobility scooters()

  • Michel Veloso de Andrade

    I tried this tutorial: httpmod-mono-server4://

    But I think MVC 5 does not working using “mod-mono-server4” only “xsp4”. =/

    • R2D2

      It does work. I managed to get it workin with mod-mono-server4