dlboutwe
dlboutwe

Reputation: 73

Not sure what I am doing wrong with Ubuntu/Apache2/Mono

Alright, it has been a long couple of days trying to figure this out and I just can't find the solution. What I am looking to do is allow my Apache server to host both PHP and ASP.NET files. So I googled around a little and discovered that the mod_mono for Apache was the way to go. I used this link (but changed the versions) and was able to successfully install the Mono Version 2.10.2 with the .Net 4.0 support (Confirmed by using the mono -V). Great, now I need to configure my vHosts (named hosts) to point the .NET sites to the right folders. I used the mono configuration maker to get that and added/enabled the site in Apache (will post a watered down version of the config file below). Now at this point, things got a little funky.

1) My Virtual hosts can no longer have the *:80 directive... I need to put the server IP instead. This isn't so big of an issue, but I though it was interesting. If I DO change one of the site's VirtualHost to *:80, all of the sites are down. Also, I had to throw the NameVirtualHost XXX.XXX.XXX.XXX line into the apache2.conf file to get this to work.

2) My PHP sites all work great, but I depending on whether I use Mono Auto Configuration (the answer) or "Default" (something like the data in the question) configuration, I either get a "The server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later." error or "internal server error" respectively.

So, basically, I am pretty damn sure that I have just messed up the configuration somewhere and I need your help to figure out where and get this stuff rolling! I will provide you with whatever you need, so hit me up if I miss something below.

Server Stats: Ubuntu 10.04 Server edition Apache 2 PHP Mono 2.10.2

example.com configuration (/etc/apache/sites-enabled)

<VirtualHost XXX.XXX.XXX.XXX>
ServerName example.com
DocumentRoot /var/www/example
</VirtualHost>

mod_mono.conf (/etc/apache2/mods-enabled)

<IfModule !mono_module>
    LoadModule mono_module "libexec/apache2/mod_mono.so"
</IfModule>

<IfModule mono_module>
    AddType application/x-asp-net .config .cs .csproj .dll .resources .resx .sln .vb .vbproj
    AddType application/x-asp-net .asax .ascx .ashx .asmx .aspx .axd .browser .licx .master .rem .sitemap .skin .soap .webinfo

    MonoAutoApplication enabled
    MonoDebug true
    MonoServerPath "/usr/bin/mod-mono-server4"
    MonoSetEnv LANG=en_US.UTF-8
    MonoUnixSocket "/tmp/.mod_mono"

    <IfModule dir_module>
        DirectoryIndex Default.aspx
    </IfModule>

    <DirectoryMatch "/(bin|App_Code|App_Data|App_GlobalResources|App_LocalResources)/">
        Order deny,allow
        Deny from all
    </DirectoryMatch>

    <Location "/Mono">
        Order deny,allow
        Deny from all
        Allow from 127.0.0.1 ::1
        SetHandler mono-ctrl
    </Location>
</IfModule>

Upvotes: 1

Views: 2551

Answers (1)

dlboutwe
dlboutwe

Reputation: 73

I was checking over those logs this morning again and I saw one that was hidden in a bunch of "missing favicon" errors: '/usr/bin/mod-mono-server4 - file or folder doesn't exist". So I did a

find / -name mod-mono-server* 

and sure enough, my only issue was with the file location I had listed.

The resolution here was to change the line:

MonoServerPath "/usr/bin/mod-mono-server4"

to the line

MonoServerPath "/usr/local/bin/mod-mono-server4"

Upvotes: 2

Related Questions