zoukankan      html  css  js  c++  java
  • 在 ubuntu 下安装 apache 和 mod_mono ,并测试

    1. 保证 ubuntu 能联网。

    2. 打开终端,输入:sudo apt-get install apache2

    3. 安装完 apache2 后,打开浏览器,输入:http://localhost/

    4. 安装 mono(由于 ubuntu 12 内置了 mono ,则跳过)

    sudo apt-get install mono-gmcs mono-xsp4

    5. 安装 mod-mono

    sudo apt-get install libapache2-mod-mono

    6. 重启 apache

    7. 提前在主文档新建一个 hello.aspx,然后 copy 到 /var/www

    <%@ Page Language="C#" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html>
    <head runat="server">
        <title>index</title>
    </head>
    <body>
        <form id="form1" runat="server">
                <asp:Literal id="ltMessage" runat="server"></asp:Literal>
            <%= DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") %>
        </form>
    </body>
    </html>

    copy 命令:sudo cp /home/bruceliu/WorkSpace/DeployementProjects/hello.aspx /var/www

    8. 打开浏览器,输入:http://127.0.0.1/hello.aspx,奇怪,怎么 hello.apsx 被下载下来了,打开一看是 aspx 的源文件, apache 没有执行它。

    9. 经过上网搜索,最后找到原因,mono没有正确配置.net引擎目录,当然不会执行.于是找到 /etc/apache2/mods-available/mod_mono.conf 文件. 用文本编辑器打开。

    改为

    10. 再次重启 apache2

    11. 打开浏览器,输入:http://127.0.0.1/hello.aspx

    12. 测试通过!

    13. 局域网访问

    如果想要局域网内其它用户也可以访问,且如果是在 VMware 下安装的 ubuntu, 那么需要确认网络配置是否是 bridged(桥接模式)。否则如果是 NAT 模式,是无法访问的。

    谢谢浏览!

  • 相关阅读:
    Find the Smallest K Elements in an Array
    Count of Smaller Number
    Number of Inversion Couple
    Delete False Elements
    Sort Array
    Tree Diameter
    Segment Tree Implementation
    Java Programming Mock Tests
    zz Morris Traversal方法遍历二叉树(非递归,不用栈,O(1)空间)
    Algorithm about SubArrays & SubStrings
  • 原文地址:https://www.cnblogs.com/Music/p/install-apache-and-mod_mono-in-ubuntu.html
Copyright © 2011-2022 走看看