ASP.NET Server with RHEL+ Apache2 + Mono
As we have already said on previous occasions, if we only want to develop with the But if what we are interested in is putting a server into production, we already have to configure our Apache so that it can launch the mod_mono module and thus run our .NET web applications under GNU/Linux.
Although part of the free world tries to make a simple assembly of this type of servers difficult, below we are going to simplify this installation on Red Hat Enterprise Linux as much as possible.
MONO INSTALLATION
We have two options for installation in RHEL in a simple and comfortable way:
Manual installation:
Download the Red Hat packages from the official website:
wget http://www.go-mono.com/download-stable/rhel-4-i386/mono.zip wget http://www.go-mono.com/download-stable/rhel-4-i386/webserver.zip wget http://www.go-mono.com/download-stable/rhel-4-i386/gtk-sharp-1.0.zip wget http://www.go-mono.com/download-stable/rhel-4-i386/devtools.zip wget http://www.go-mono.com/download-stable/rhel-4-i386/gtk-sharp-2.0.zip
We decompress the files:
unzip *
And we proceed to install the necessary packages:
rpm -i mono-complete-1.2.6-4.novell.i586.rpm mono-data-1.2.6-4.novell.i586.rpm mono-core-1.2.6-4.novell.i586.rpm mono-web-1.2.6-4.novell.i586.rpm mono-winforms-1.2.6-4.novell.i586.rpm mono-locale-extras-1.2.6-4.novell.i586.rpm mono-extras-1.2.6-4.novell.i586.rpm mono-data-oracle-1.2.6-4.novell.i586.rpm mono-data-postgresql-1.2.6-4.novell.i586.rpm mono-data-sqlite-1.2.6-4.novell.i586.rpm mono-data-sybase-1.2.6-4.novell.i586.rpm libgdiplus-1.2.6-2.rhel4.novell.i386.rpm bytefx-data-mysql-1.2.6-4.novell.i586.rpm ibm-data-db2-1.2.6-4.novell.i586.rpm xsp-1.2.6-2.novell.noarch.rpm mono-nunit-1.2.6-4.novell.i586.rpm
Installation from repository:
Without a doubt the most recommended, since we will be up to date with the updates directly from Novell’s own official repository.
cd /etc/yum.repos.d/
wget http://www.go-mono.com/download-stable/rhel-4-i386/mono.repo
yum install mono mod_mono mono-data-oracle
APACHE2 SERVER CONFIGURATION
First we need to load the mod_mono module in Apache2 so we edit the file /etc/httpd/conf/httpd.conf and in the module loading section we write:
LoadModule mono_module modules/mod_mono.so
All we need is the configuration of this module, in which we will indicate the files on which it has to be launched, where the server that will process the requests is,… So we edit/create the file /etc/httpd/conf.d/mod_mono.conf
<IfModule mod_mono.c>
MonoUnixSocket default /tmp/.mod_mono_server2 MonoServerPath default /usr/bin/mod-mono-server2 AddType application/x-asp-net .aspx .ashx .asmx .ascx .asax .config .ascx MonoApplicationsConfigDir default /etc/mono/2.0/ MonoPath default /usr/lib/mono/2.0:/usr/lib
Alias /OurAPP"/var/www/OurAPP" AddMonoApplications default “/OurAPP:/var/www/OurAPP” <Directory /var/www/NuestraAPP> SetHandler mono <IfModule mod_dir.c> DirectoryIndex index.aspx default.aspx index.html Service.asmx