zoukankan      html  css  js  c++  java
  • 在Windows系统中用nginx与mono搭建asp.net运行环境,附详细例图与代码 狼人:

    一、下载nginx安装包和mono安装包

    下载Nginx:到Nginx下载对应的版本

    下载Mono对应平台:下载 Mono

    二、安装配置

    解压nginx到C:盘

    打开C:\nginx\conf\nginx.conf文件,并且将以下代码覆盖

    worker_processes  1;
    error_log logs/error-debug.log info;

    events {
    worker_connections 1024;
    }

    http {
    include mime.types;
    default_type text/plain;
    sendfile on;

    keepalive_timeout 65;
    index index.html index.htm;

    server {
    listen 80;
    server_name localhost;
    index index.aspx default.aspx;

    location / {
    root C:/nginx/html/aspnetwww;

    fastcgi_pass 127.0.0.1:8282;
    fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name;
    include fastcgi_params;
    }
    }
    }

     注意:1、“80”代表监听HTTP的80端口,2、“C:/nginx/html/aspnetwww”代表网站路径,3、“127.0.0.1:8282”代表fastcgi的地址。

    下一步再安装mono,安装的时候注意设置端口为我们上一步为他预留的“8282”(在这里我安装到了D:\FastCGI-Mono-Server\);

    安装好mono后我们在CMD命令行中输入:

    D:\FastCGI-Mono-Server\bin\fastcgi-mono-server2 /socket=tcp:127.0.0.1:8282 /root="C:\nginx\html\aspnetwww" /applications=/:. /multiplex=True

    (您也可以设置一个批处理,免得每次都要打开CMD来启动fastcgi)

    命令执行后会一直处于这个状态,即表示正在运行,在这里记住不要关闭此窗口。

    好了,我们再来运行C:\nginx\nginx.exe,你会看到:

    即表示nginx配置正确,下一步我们写一个asp.net的页面(乘法口诀)

    <%@ Page Language="C#" AutoEventWireup="true" %>
    <%@ Import Namespace="System" %>
    <%@ Import Namespace="System.Web" %>
    <% Response.Write(DateTime.Now); %>
    <hr />
    <pre>
    <%
    for (int i=1;i<10;i++)
    {
        for (int j=i;j<10;j++)
        {
            Response.Write(string.Format("{0,-10}",i + "*" + j + "=" + i * j + "    "));
        }
        Response.Write("\n");
    }
    %>
    </pre>
    <hr />
    fastcgi-mono-server2 /socket=tcp:127.0.0.1:8282 /root="C:\nginx\html\aspnetwww" /applications=/:. /multiplex=True
    <hr />
    tasklist /fi "imagename eq nginx.exe"
    

    查下运行结果:

     好了,配置成功

    声明:此博有部分内容为转载,版权归原作者所有~
  • 相关阅读:
    解决PKIX:unable to find valid certification path to requested target 的问题
    Linux 上的常用文件传输方式介绍与比较
    用VNC远程图形化连接Linux桌面的配置方法
    红帽中出现”This system is not registered with RHN”的解决方案
    linux安装时出现your cpu does not support long mode的解决方法
    CentOS SSH配置
    es6扩展运算符及rest运算符总结
    es6解构赋值总结
    tortoisegit安装、clon、推送
    es6环境搭建
  • 原文地址:https://www.cnblogs.com/waw/p/2332006.html
Copyright © 2011-2022 走看看