Setting up ModMono With Apache2

2019-06-11 09:18发布

I ended up attempting to setup ASP with ModMono on Apache2, via following this guide.

It's not working, however: when I click a .aspx file, I end up just downloading it on my localhost.

Here's my asp.webapp file /etc/mono-server2

<apps>
    <web-application>
        <name>asp</asp>
        <vpath>/asp</vpath>
        <path>/var/www/asp/</path>
        <vhost>127.0.0.1</vhost>
    </web-application>
</apps>

and my asp file in /etc/apache2/sites-available/

<Virtualhost 127.0.1.1:80>
    ServerName asp

    DocumentRoot /var/www/asp/

    <Directory /var/www/asp/>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Order allow, deny
        Allow from all 
        SetHandler mono
        DirectoryIndex index.aspx index.html
    </Directory>
</VirtualHost>

Is there anything which I'm doing wrong here? The only issue I can think of is that I'm trying to reference a directory, rather than a specific page or file.

1条回答
男人必须洒脱
2楼-- · 2019-06-11 09:39

If you have installed mod_mono and it is configured correctly to work with apache2 then all you will need to do is change your site configuration in /etc/apache2/sites-available/ to something like this:

<Virtualhost 127.0.1.1:80>
ServerName asp
DirectoryIndex index.html index.aspx
DocumentRoot /var/www/asp/

AddMonoApplications asp "/:/var/www/asp"
MonoServerPath asp "/usr/bin/mod-mono-server2"

<Directory /var/www/asp/>
    MonoSetServerAlias asp
    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>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride All
    Order allow, deny
    Allow from all 
    SetHandler mono
    DirectoryIndex index.aspx
</Directory>

查看更多
登录 后发表回答