ISPConfig and Mono

Discussion in 'Tips/Tricks/Mods' started by rusvdw, Oct 10, 2007.

  1. rusvdw

    rusvdw New Member

    Been struggling with getting asp.net working with mono in ISPConfig on my Ubuntu Edgy box for a couple of days now. Just got it working, so thought i'd best post the configs here for others in need (and probably myself again when I screw everything up).

    Let me also state that I'm no expert at this, this is just what happens to have worked for me.

    Firstly, make sure you've got mod_mono installed and working with apache2 before trying this. See http://timanisblog.com/2007/07/22/install-mono-apache-mod-mono-applications-in-ubuntu/ for instructions on doing so.

    Next, get into your ISPConfig administrators panel, click on the site you wish to enable mono for and enter the following in the "Apache Directives
    (Optional)" field:

    Code:
    MonoAutoApplication enabled
    MonoDocumentRootDir "/var/www/web1/web/"
    MonoServerPath example "/usr/bin/mod-mono-server2"
    MonoApplications example "/:/var/www/web1/web/"
    Alias /mono "/var/www/web1/web/"
    <Directory /var/www/web1/web/>
    SetHandler mono
    MonoSetServerAlias example
    AddHandler mod_mono .aspx .ascx .asax .ashx .config .cs .asmx
    </Directory>
    
    Of course you should make sure that you change "example" to a string that's relevant for you. Do not put the full hostname in there (e.g. example.com). Doing so was what kept me busy with this for 2 days :mad: You should also of course make sure that the "/var/www/web1/web/" part reflects the correct path for the website you're enabling mono for.

    Be aware that if the stuff you entered has errors, ISPConfig won't tell you about it. You may want to check the /etc/apache2/vhosts/Vhosts_ispconfig.conf file to make sure that what you entered is indeed being saved in the hosts file.

    As a final example, your Vhosts_ispconfig.conf should look something like this after completing the steps above:

    Code:
    ###################################
    #
    # ISPConfig vHost Configuration File
    #         Version 1.0
    #
    ###################################
    #
    NameVirtualHost 123.123.123.123:80
    <VirtualHost 123.123.123.123:80>
      ServerName localhost
      ServerAdmin root@localhost
      DocumentRoot /var/www/sharedip
    </VirtualHost>
    #
    #
    ######################################
    # Vhost: www.example.co.za:80
    ######################################
    #
    #
    <VirtualHost 123.123.123.123:80>
    MonoAutoApplication enabled
    MonoDocumentRootDir "/var/www/web1/web/"
    MonoServerPath example "/usr/bin/mod-mono-server2"
    MonoApplications example "/:/var/www/web1/web/"
    Alias /mono "/var/www/web1/web/"
    <Directory /var/www/web1/web/>
    SetHandler mono
    MonoSetServerAlias example
    AddHandler mod_mono .aspx .ascx .asax .ashx .config .cs .asmx
    </Directory>
    ServerName www.example.co.za:80
    ServerAdmin [email protected]
    DocumentRoot /var/www/web1/web
    ServerAlias example.co.za m.example.co.za
    DirectoryIndex index.html index.htm index.php index.php5 index.php4 index.php3 index.shtml index.cgi index.pl index.jsp Default.htm default.htm default.aspx Default.aspx
    ScriptAlias  /cgi-bin/ /var/www/web1/cgi-bin/
    AddHandler cgi-script .cgi
    AddHandler cgi-script .pl
    ErrorLog /var/www/web1/log/error.log
    AddType application/x-httpd-php .php .php3 .php4 .php5
    <Files *.php>
        SetOutputFilter PHP
        SetInputFilter PHP
    </Files>
    <Files *.php3>
        SetOutputFilter PHP
        SetInputFilter PHP
    </Files>
    <Files *.php4>
        SetOutputFilter PHP
        SetInputFilter PHP
    </Files>
    <Files *.php5>
        SetOutputFilter PHP
        SetInputFilter PHP
    </Files>
    php_admin_flag safe_mode Off
    AddType text/html .shtml
    AddOutputFilter INCLUDES .shtml
    Alias /error/ "/var/www/web1/web/error/"
    ErrorDocument 400 /error/invalidSyntax.html
    ErrorDocument 401 /error/authorizationRequired.html
    ErrorDocument 403 /error/forbidden.html
    ErrorDocument 404 /error/fileNotFound.html
    ErrorDocument 405 /error/methodNotAllowed.html
    ErrorDocument 500 /error/internalServerError.html
    ErrorDocument 503 /error/overloaded.html
    AliasMatch ^/~([^/]+)(/(.*))? /var/www/web1/user/$1/web/$3
    AliasMatch ^/users/([^/]+)(/(.*))? /var/www/web1/user/$1/web/$3
    </VirtualHost>
    #
    
     
  2. Ben

    Ben ISPConfig Developer ISPConfig Developer

    That's right, for that purpose you could check the ispconfig.log anywhere in /root/ispconfig/, ideally with tail -f to see which exact error httpd throws when trying to start with the new generated config.
     
  3. davidcapo

    davidcapo New Member

    Solution

    application can not run mod_mono index in the same directory where the application is running php default, this is why it causes these problems is solved instead of completing what you have written in the apache directives in ispconfig internal folder test example, then where it says:
    /:/var/www/web1/web/
    replace for:
    /test:/var/www/web1/web/test/

    complete apache directives:

    MonoPath default "/usr/lib/mono/2.0"
    MonoServerPath default /usr/bin/mod-mono-server2
    AddMonoApplications default "/test:/var/www/web1/web/test/"
    <location /test>
    MonoSetServerAlias default
    SetHandler mono
    </location>

    www.ddpyp.com.ar
     

Share This Page