Tutorial :running 2 websites with mono


I have 2 websites : myDomain1.com & myDomain2.com

Both run on the same apache server with Mono. However my issue is that i cannot get them working at the same time. When i go to myDomain2.com it shows the aspx content of myDomain1.com. Occassiononly this is inversed. So that myDomain1.com shows the content for myDomain2.com. I think this happens when i restart apache. Anythoughts on what might be happening here?

my Config. ( The config for myDomain2.com is exactly the same except all the relevant properties are called myDomain2.com )

<VirtualHost *:8014>          ServerAdmin webmaster@myisp.com          DocumentRoot /home/advanced/myUserName/public_html/myDomain1.com          ServerName myDomain1.com          ServerAlias www.myDomain1.com devel.myDomain1.com            CustomLog logs/myDomain1.com-access.log combined          ScriptAlias /cgi-bin/ /home/advanced/myUserName/public_html/myDomain1.com/cgi-bin/         ## Mono (ASP.NET)          MonoUnixSocket myDomain1.com /home/advanced/myUserName/tmp/mod_mono.sock          MonoWapidir myDomain1.com "/home/advanced/myUserName/tmp/"          MonoApplications myDomain1.com "/:/home/advanced/myUserName/public_html/myDomain1.com/"          AddMonoApplications myDomain1.com "/:/home/advanced/myUserName/public_html/myDomain1.com/"          <Location /myDomain1.com>          AddHandler mono .aspx .ashx .asmx .ascx .asax .config .ascx          MonoSetServerAlias myDomain1.com          </Location>    </VirtualHost>  <Directory /home/advanced/myUserName/public_html/myDomain1.com/cgi-bin/>          SetHandler cgi-script  </Directory>  


Since your config file contains a lot of stuff I wouldn't necessarily use, I would suggest starting from the basics and adding stuff until it breaks again.

I'm successfully running multiple sites on my Mono server, and my config is done as follows:

Create a file in your apache2 sites-enabled folder for each of the domains and add the following:

<VirtualHost *:80>    ServerName www.domain1.com  ServerAdmin webmaster@domain1.com  DocumentRoot /var/www/domain1  DirectoryIndex index.html index.aspx    AddMonoApplications blogsite "/:/var/www/domain1"  MonoServerPath blogsite "/usr/local/bin/mod-mono-server2"    <Directory /var/www/domain1>      MonoSetServerAlias domain1      SetHandler mono      AddHandler mod_mono .aspx .ascx .asax .ashx .config .cs .asmx           <FilesMatch "\.(gif|jp?g|png|css|ico|xsl|wmv|zip)$">              SetHandler None          </FilesMatch>      DirectoryIndex index.aspx      Options Indexes FollowSymLinks MultiViews      AllowOverride None      Order allow,deny      allow from all  </Directory>    </VirtualHost>  

You will obviously have to change all the paths and domains to ones that match your server configuration.

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »