使用 Apache2 设置 ModMono

发布于 2024-12-09 12:40:06 字数 908 浏览 1 评论 0原文

我最终尝试按照本指南在 Apache2 上使用 ModMono 设置 ASP。

然而,它不起作用:当我单击 .aspx 文件时,我最终只是将其下载到我的本地主机上。

这是我的 asp.webapp 文件 /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>

和 /etc/apache2/sites-available/ 中的 asp 文件

<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>

我在这里做错了什么吗?我能想到的唯一问题是我试图引用一个目录,而不是特定的页面或文件。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

绳情 2024-12-16 12:40:06

如果您已经安装了 mod_mono 并且它已正确配置为与 apache2 一起使用,那么您需要做的就是将 /etc/apache2/sites-available/ 中的站点配置更改为如下所示:

<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>

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>

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文