frosty
frosty

Reputation: 5370

Running 2 websites with mono

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

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.example it shows the aspx content of myDomain1.example. Occassiononly this is inversed. So that myDomain1.example shows the content for myDomain2.example. I think this happens when I restart Apache. Anythoughts on what might be happening here?

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

<VirtualHost *:8014>
        ServerAdmin [email protected]
        DocumentRoot /home/advanced/myUserName/public_html/myDomain1.example
        ServerName myDomain1.example
        ServerAlias www.myDomain1.example devel.myDomain1.example

        CustomLog logs/myDomain1.com-access.log combined
        ScriptAlias /cgi-bin/ /home/advanced/myUserName/public_html/myDomain1.example/cgi-bin/

     ## Mono (ASP.NET)
        MonoUnixSocket myDomain1.example /home/advanced/myUserName/tmp/mod_mono.sock
        MonoWapidir myDomain1.example "/home/advanced/myUserName/tmp/"
        MonoApplications myDomain1.example "/:/home/advanced/myUserName/public_html/myDomain1.example/"
        AddMonoApplications myDomain1.example "/:/home/advanced/myUserName/public_html/myDomain1.example/"
        <Location /myDomain1.example>
        AddHandler mono .aspx .ashx .asmx .ascx .asax .config .ascx
        MonoSetServerAlias myDomain1.example
        </Location>

</VirtualHost>
<Directory /home/advanced/myUserName/public_html/myDomain1.example/cgi-bin/>
        SetHandler cgi-script
</Directory>

Upvotes: 1

Views: 548

Answers (1)

rusvdw
rusvdw

Reputation: 443

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.example.com
ServerAdmin [email protected]
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.

Upvotes: 1

Related Questions