RubyPDF Blog .NET,ASP.Net,CentOS,English,Hosting,Linux,tutorial How to Install XSP and Integrate XSP With Apache 2 Under CentOS 5

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

8 thoughts on “How to Install XSP and Integrate XSP With Apache 2 Under CentOS 5”

  1. Any input on setting this up under ISPConfig 3? (CentOS 5.4)

    I built mono-2.4.2.3, xsp-2.4.2 and mod_mono-2.4.2 and then tried some Apache directives I found on a very old post (for ubuntu, no less) to no avail.

  2. ISPConfig (ispconfig.org) is an all-in-one web hosting package. An admin with this package can add sites, domains, control e-mail boxes, dns, system logs, etc all from a web interface designed for web hosting.

    It configures apache on its own, but I haven’t been able to find any information to help me setup Mono for one of the sites I have setup in ISPConfig. I’d like to run a .NET web application within one of these sites. I’ve found a few older posts for other distros on how to add the correct apache directives to my vhost file. No luck yet!

  3. THANK YOU THANK YOU THANK YOU THANK YOU – i’ve been trying to get my centos/mono/apache site to work for the past 2 days… repaved about a dozen times now because things got broken, and mono didn’t ever work… yours is the first tut with all the right instructions.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.