this is a quick list of the steps required to deploy .Net applications under Apache 2 and mod_mono in OpenSuse 11
- Compile your web application. You can do it on Linux using MonoDevelop or using Visual Studio 2008, we usually compile it on Linux just to be sure the website will no have problems to start.
- Create a folder for your application.
In our case we created a folder named "WebApp " under this directory:
/usr/share/mono/asp.net/apps/
just because there were other demo applications that come with mono.
Be sure to give this folder the right permissions. open a Console and log in as the root user (sudo -s) and move to the folder. Use the chmod command to change the permissions if necessary (chmod 777 ./ will enable all the permissions under this folder, you can try adding only the necessary access level, because 777 enable all of them)
- copy the contents of the compiled web application to the new folder created.
- navigate to the folder "/etc/apache2/conf.d" and create a text file named "WebApp.conf"
- copy this code inside the file
Alias /WebApp /usr/share/mono/asp.net/apps/WebApp MonoApplicationsConfigFile WebApp /etc/xsp/2.0/applications-available/WebApp.webapp MonoServerPath WebApp "/usr/bin/mod-mono-server2" MonoSetEnv WebApp MONO_IOMAP=all <Location /WebApp> Allow from all Order allow,deny SetHandler mono MonoSetServerAlias WebApp </Location>
- As you can see in the line 2 we point to a WebApp file that should be located in the /etc/xsp/2.0/applications-available/, so navigate to that folder an create a WebApp.webapp text fileand put this code inside this file:
<?xml version="1.0" ?> <web-application> <name>WebApp</name> <vpath>/WebApp</vpath> <path>/usr/share/mono/asp.net/apps/WebApp</path> <enabled>true</enabled> </web-application>
- Now is time to restart apache, so run this command: "apache2ctl restart".
- Now open your browser and navigate to http://localhost/WebApp/Default.aspx (if Default.aspx exist or maybe other page that you have in the site)
- If all went without errors now you can enjoy your new website running under Apache 2 using mod_mono 2.2
Notes: There a lot of things that could go, wrong, maybe you will need to first Install Apache 2, if you don't already have it in your Linux distro, or maybe the mod_mono 2.2. Those tasks are out of the scope of this post. The present list of steps were written here just to never forget them.if you need help to install apache 2 or mod_mono, or even MONO 2.2, then you will need to do some googling by yourself. sorry :(