Question

My home system is an Ubuntu 13.4 (upgraded from 12.10) desktop system, where I do some development, mainly in PHP, and I have Apache installed and working fine.

I need to do some development in ASP.NET and I installed MonoDevelop, as well as an XSP server. From MonoDevelop I can launch XSP, which serves at port 8080 (localhost:8080). This is okay during a development session, but for some reason XSP seem to be timed out, and my router doesn't serve port 8080; aditionally, XSP only serves one mono project at a time.

I have attempted to configure a virtual host with Apache, but it is not working. I get 404 errors both for static files, aspx files and nonexistent files.

My vhost configruation is as following:

<virtualhost *:80>
    ServerAdmin webmaster@mydomain.net
    ServerName  myproject.local
    ServerAlias myproject.mydomain.net

    DocumentRoot    /home/myuser/source/myproject/myproject
    <Directory /home/myuser/source/myproject/myproject>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride None
        Order allow,deny
        Allow from all
        SetHandler  mono
        DirectoryIndex  Default.aspx index.aspx index.html
    </Directory>

    LogLevel    debug
    ErrorLog    /var/www/vhosts/myproject/log/error.log
    CustomLog   /var/www/vhosts/myproject/log/access.log combined
</virtualhost>

Looking at the error log, I find the following messages:

[Mon Oct 07 00:42:45 2013] [debug] mod_deflate.c(615): [client 127.0.0.1] Zlib: Compressed 279 to 214 : URL /
[Mon Oct 07 00:43:00 2013] [debug] mod_deflate.c(615): [client 127.0.0.1] Zlib: Compressed 291 to 223 : URL /Default.aspx
[Mon Oct 07 00:43:04 2013] [error] [client 127.0.0.1] script '/home/myuser/source/myproject/myproject/Default.php' not found or unable to stat
[Mon Oct 07 00:43:04 2013] [debug] mod_deflate.c(615): [client 127.0.0.1] Zlib: Compressed 290 to 222 : URL /Default.php
[Mon Oct 07 00:43:14 2013] [debug] mod_deflate.c(615): [client 127.0.0.1] Zlib: Compressed 292 to 222 : URL /Template.css
[Wed Oct 09 12:36:00 2013] [debug] mod_deflate.c(615): [client 127.0.0.1] Zlib: Compressed 290 to 221 : URL /favicon.ico

The files Default.php and favicon.ico do not exist, the other files Default.aspx and Template.css do exist.

Thank you in advance.


Update

I missed a part of the configuration: the webapp file. I added to /etc/mono-server4/debiab.webapp to add the project.

<apps>
<web-application>
    <name>myproject</name>
    <vhost>myproject</vhost>
    <vport>80</vport>
    <vpath>/</vpath>
    <path>/home/myuser/source/myproject/myproject/</path>
    <enabled>true</enabled>
</web-application>
</apps>

Now it works!


Now, I cannot make it work for virtual directories for different apps.

Was it helpful?

Solution

Okay, my original question was answered by including the web application in the .webapp file in the /etc/mono-server directory. During the process I decided to try using only one virtual host for all related Mono/ASP projects, so I came to the following configuration for virtual directories (alias).

The mytestsite.local virtual host (at /etc/apache2/sites-available/ and linked at /etc/apache2/sites-enabled/)

<virtualhost *:80>
    ServerAdmin webmaster@interlecto.net
    ServerName  mytestsite.local
    ServerAlias mytestsite.mydomain.net *.mytestsite.mydomain.net

    MonoAutoApplication disabled
    AddHandler  mono    .aspx .ascx .asax .ashx .config .cs .asmx .axd

    DocumentRoot    /var/www/vhosts/mytestsite/root
    <Directory /var/www/vhosts/mytestsite/root>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride None
        Order allow,deny
        Allow from all
    </Directory>
    DirectoryIndex  Default.aspx index.aspx index.html

    Alias   /myproject  "/home/myuser/source/myproject/myproject"
    Alias   /othertest  "/home/myuser/source/othertest/othertest"
    MonoApplications    default "/myproject:/home/myuser/source/myproject/myproject,/othertest:/home/myuser/source/othertest/othertest"

    <Location /myproject>
        SetHandler  mono
    </location>
    <Location /othertest>
        SetHandler  mono
    </location>

    <Directory /home/myuser/source/myproject/myproject>
        AllowOverride None
        Order allow,deny
        Allow from all
    </Directory>
    <Directory /home/myuser/source/othertest/othertest>
        AllowOverride None
        Order allow,deny
        Allow from all
    </Directory>

    LogLevel    debug
    ErrorLog    /var/www/vhosts/mytestsite/log/error.log
    CustomLog   /var/www/vhosts/mytestsite/log/access.log combined
</virtualhost>

The debian.webapp file (at /etc/mono-server4/)

<apps>
    <web-application>
        <name>My Project</name>
        <vpath>/myproject</vpath>
        <path>/home/myuser/source/myproject/myproject</path>
        <vhost>mytestsite.local</vhost>
    </web-application>
    <web-application>
        <name>Other Test</name>
        <vpath>/othertest</vpath>
        <path>/home/myuser/source/othertest/othertest</path>
        <vhost>mytestsite.local</vhost>
    </web-application>
</apps>

At my Virtual Host root (/var/www/vhosts/mytestsite/root/) I have a simple index.html file allowing me to choose which test.

So now I have Mono (mod_mono for ASP.NET) working on a couple of virtual directories on a virtual host on Apache on Ubuntu.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top