Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have 3 sites and a default/test site using mono's test page.

I created aFirst, c, d, e, zLast. zLast has rewrite rules that should be evaluated last. Since the first VirtualHost seen is the default i set it to this

--aFirst--
<VirtualHost *:80>
    ServerName www.domain.tld
    ServerAdmin webmaster@localhost
    DocumentRoot /var/www/test
    DirectoryIndex index.html index.aspx index.php
    MonoDocumentRootDir "/var/www/test"
    MonoServerPath rootsite "/usr/local/bin/mod-mono-server2"
    MonoApplications rootsite "/:/var/www/test"

    <Directory /var/www/test>
        MonoSetServerAlias rootsite
        SetHandler mono
        AddHandler mod_mono .aspx .ascx .asax .ashx .config .cs .asmx
    </Directory>
</VirtualHost>

The problem is my default page (the ip address of my server) and the first website (csite.ddomain.net) have problems (even though csite is defined in c and is not the first virtual host). The ip address of my server and csite.ddomain.net ALWAYS load the same site. Either monos test page or the csite. It flips every time i restart apache. Why isnt the server ip address always loading the default page (mono test page) and why isnt csite.ddomain.net always loading the site i want!?!

Heres the config for

--csite--
<VirtualHost *:80>
    ServerName  csite.testdomain.net
    ServerAdmin webmaster@localhost

    ServerAlias s.csite.testdomain.net

    DocumentRoot /var/www/prjname
    DirectoryIndex index.html index.aspx
    MonoDocumentRootDir "/var/www/prjname"
    MonoServerPath rootsite "/usr/local/bin/mod-mono-server2"
    MonoApplications rootsite "/:/var/www/prjname"

    <Directory /var/www/prjname>
        MonoSetServerAlias rootsite
        SetHandler mono
        AddHandler mod_mono .aspx .ascx .asax .ashx .config .cs .asmx
    </Directory>

</VirtualHost>

aFirst, c, d, e, zLast are all enabled.

share|improve this question

2 Answers 2

Do you have 'NameVirtualHost *:80' defined before all your virtual hosts? Are all your sited listed in one file in order?

share|improve this answer
    
No, but now i added NameVirtualHost *:80 at the top of aFirst. I got this msg on restart [warn] NameVirtualHost *:80 has no VirtualHosts. I still have the same problem. and no, multiple files and they are called aFirst, c, d, e, zLast –  acidzombie24 Dec 29 '10 at 14:11
    
ok i fixed it. i'll post my answer tonight (8hours) after work –  acidzombie24 Dec 29 '10 at 15:16
up vote 0 down vote accepted

I used this page to install mono on my debian box. http://blog.ruski.co.za/page/Install-Mono-on-Ubuntu.aspx

Under Configure Apache2 Virtual Hosts it shows the below.

The problem was i copied paste this and changed the directory for each of my site. The name (in this case rootsite) needs to be different so i fixed it by changing rootsite to prjname_site for each of my sites. Now it restarts with no problems and i dont get any conflicts of what domain shows up where.

Additional Note: Currently I like mono 2.6.* better then 2.8.* since 2.8 doesnt give me accurate information on loading errors. 2.6 handles everything in .NET 3.5 AFAIK.

<VirtualHost *>
    ServerName www.local.com
    ServerAdmin webmaster@localhost
    DocumentRoot /var/www/test
    DirectoryIndex index.html index.aspx
    MonoDocumentRootDir "/var/www/test"
    MonoServerPath rootsite "/usr/local/bin/mod-mono-server2"
    MonoApplications rootsite "/:/var/www/test"
    <Directory /var/www/test>
        MonoSetServerAlias rootsite
        SetHandler mono
        AddHandler mod_mono .aspx .ascx .asax .ashx .config .cs .asmx
    </Directory>
</VirtualHost>
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.