How to Install XSP and Integrate XSP With Apache 2 Under CentOS 5

In the last article, I have introduced How to Install Mono 2.4.2.3 on CentOS 5 , forgot telling you, why I want to install Mono on CentOS, I want to try to run ASP.NET under Linux.

Mono has an implementation of ASP.NET 2.0 and ASP.NET AJAX, and to run your ASP.NET applications with Mono, you have three classes of options:

  • Apache hosting: use mod_mono, a module that allows Apache to serve ASP.NET applications.
  • FastCGI hosting: use the FastCGI hosting if you have a web server that supports the FastCGI protocol for extending the server. You also may use a web server that only has support for CGI using cgi-fcgi.
  • XSP: this is a simple way to get started, a lightweight and simple webserver written in C#.

XSP is a standalone web server written in C# that can be used to run your ASP.NET applications with minimal effort.
The mod_mono Apache module is used to run ASP.NET applications within the Apache (http://httpd.apache.org) web server.

Let’s continue install XSP and mod_mono now.
1.Go to this page and download xsp-2.4.2.tar.bz2,
#wget http://ftp.novell.com/pub/mono/sources/xsp/xsp-2.4.2.tar.bz2

2. Extract the download file,
# tar jxvf xsp-2.4.2.tar.bz2

3. In to the xsp-2.4.2 folder,
#cd xsp-2.4.2

4.configure, build and install XSP,
# ./configure –prefix=/opt/mono; make; make install
because I installed mono in /opt/mono, so the same treat to XSP

5.go to the parent folder,
#cd ..

6.by default, Apache 2 has been installed, make sure you have installed httpd-devel, or you will get error message like”**** apxs was not found,” when you build mod_mono,
#yum -y install httpd-devel

7.Go to this page and download mod_mono-2.4.2.tar.bz2

8. Extract the download file,
# tar jxvf mod_mono-2.4.2.tar.bz2

9. In to the mod_mono-2.4.2 folder,
#cd mod_mono-2.4.2

10.configure, build and install mod_mono,
# ./configure –prefix=/opt/mono; make; make install

11.You may want to verify a few thigns to make sure the configuration is ready to rock. In my case, I am keeping the mono configuration in a separate file for sanity sake. You can do that or put it all in your httpd.conf, it’s up to you,

<IfModule !mod_mono.c>
LoadModule mono_module /usr/lib/httpd/modules/mod_mono.so
AddType application/x-asp-net .aspx
AddType application/x-asp-net .asmx

AddType application/x-asp-net .ashx
AddType application/x-asp-net .asax
AddType application/x-asp-net .ascx
AddType application/x-asp-net .soap
AddType application/x-asp-net .rem
AddType application/x-asp-net .axd
AddType application/x-asp-net .cs
AddType application/x-asp-net .config
AddType application/x-asp-net .Config
AddType application/x-asp-net .dll
DirectoryIndex index.aspx
DirectoryIndex Default.aspx
DirectoryIndex default.aspx
</IfModule>

<VirtualHost *:80>
DocumentRoot /home/httpd/aspx/html
ServerName aspx.yoursite.com
Alias /demo /opt/mono/lib/xsp/test
MonoApplications "/demo:/opt/mono/lib/xsp/test"
MonoServerPath /opt/mono/bin/mod-mono-server2
<Directory /opt/mono/lib/xps/test>
SetHandler mono
</Directory>
</VirtualHost>

12.restart httpd service,
#service httpd restart

13.Test it,
visit http://aspx.yoursite.com/demo in your browser, and if you get the page with the title “Welcome to Mono XSP!”, congratulation!

references,
ASP.NET and Mono
My Adventures Installing mono 2.0 on CentOS 4 to work with Apache via mod_mono

Leave a Reply