Dec 16, 2011, 08:05 AM
Mono / mod_mono setup (CentOS 5)
I've been trying to get mod_mono to work on my server and have been failing miserably.
I want to be able to run MVC3 sites that require the latest version of Mono.
I have managed to install mod_mono & mono server via YUM (I am running CentOS 5) but can't work out how to configure an individual virtual site to use it.
I have been trying to configure this for a particular domain. Plesk appears to set things up so that each virtual site has it's own
conf directory: i.e. /var/www/vhosts/mydomain.com/conf/
In here, I think you are supposed to be able to add a vhost.conf that is used to configure the site, but nothing I do here seems to work (to get it to act as an MVC3 site using Mono).
Are there any gurus out there that might be able to offer some advice (or just do it for me - and explain how I can do it for future sites)? I am willing to pay for some you to do it if your rates are reasonable.
Last edited by dcollis; Dec 19, 2011 at 08:03 AM.
Reason: Wanted to make title clearer for others
Dec 16, 2011, 08:25 AM
These instructions helped me get to the point I am at now: http://developer.mindtouch.com/en/do...Mono_on_CentOS
Dec 16, 2011, 08:45 AM
This is the next thing I tried:
(I added the example conf there with paths updated as the vhost.conf file in the /var/www/vhosts/mydomain.com/conf/ directory).
After restarting httpd and browsing to mydomain.com I was presented with the Apache 2 Test Page. Other sites appear to work correctly still...
Dec 19, 2011, 03:23 AM
Well, I got something to work by taking the contents of the vhost.conf and putting it directly into the .include file that Plesk generates (which comes with a nice warning at the top telling you *not* to edit it and instead create the vhost.conf file).
However, doing this appears to allow the mono server to attempt to start up when i visit the domain in question. Although it now throws an exception immediately. But I think perhaps this is a question for the mono mailing list.
I will report back if I get any further, however, I would still be interested in what I am supposed to do rather than editing that .include file that Plesks warns me against doing...
Dec 19, 2011, 08:02 AM
Good news - Mono 2.10.2 is working on my server now.
The misleading errors I was getting in my httpd\error log turned out to be caused be dlls in my bin directory that shouldn't be there. You need to remove the majority of the System.*.dlls as well as Microsoft.Web.Infrastructure, leaving just these ones:
With this in-place, I was able to get my MVC3 site to run.
So, now I just need to know how to make all of this Plesk-friendly. As I am fairly sure replacing the generated httpd.include file in my virtual host conf directory is the wrong way to go about this.
If anyone has an answer for me, please let me know.
Dec 19, 2011, 08:05 AM
Dec 19, 2011, 11:29 AM
A couple of other notes for other people who end up here looking for a solution:
Ensure you install mono-addon mod_mono-addon versions. If you still have mono standard installed it might have conflicts. yum remove anything that is version 1.x.
If you directly reference mono server paths if your conf file, then you don't need to worry. If you're going to sym links in /usr/bin then ensure they link to the correct version (delete & recreate if you need to).
In your main /etc/httpd/conf/httpd.conf:
Move the line:
To after the lines:
In your /etc/httpd/conf.d:
The installer for me put in an incorrect path for the mod_mono.so (in the LoadModule line).
Change it to: LoadModule mono_module modules/mod_mono.so (if it isn't this).
If you are making https requests in your code (from your server to other servers), you'll need to jump through hoops: http://www.mono-project.com/FAQ:_Security (there are various ways to solve this problem, including turning it off, with a line such as this: ServicePointManager.ServerCertificateValidationCal lback += (s, c, ch, ssl) => true;
If you are using MEF, don't try and use DirectoryCatelogs (this causes problems when indexing dlls that have no exports). If using MefContrib, you'll need to add your own custom MvcApplicationRegistry into the startup so it doesn't scan the entire bin folder.
Again, if anyone has an answer to how to this without over-writing Plesk generated conf files, I'd love to know
Tags for this Thread