zoukankan      html  css  js  c++  java
  • ASP.NET MVC + Mono + Nginx基础

    如果是Ubuntu Desktop,则在软件中心中安装Nginx、mono-fastcgi-server4(或server2)
    如果是CentOS,则用yum install安装以上工具,并安装mono相关环境
     
    使用MonoDevelop可以创建、编辑、编译、发布ASP.NET MVC程序。
     
    以Ubuntu 11.10为例,Nginx的默认www文件夹在/usr/share/nginx/www/,配置文件在/etc/nginx/nginx.conf。
    • 首先使用MonoDevelop创建一个MVC项目,并发布到/usr/share/nginx/www/MyTest文件夹,如果发布提示没有权限,则可以先cd至/usr/share/nginx/www,然后执行sodu chmod 777 * -R,为该文件夹赋予所有人读写的权限(生产环境不要这么做。。。);
    • 然后sodu gedit /etc/nginx/nginx.conf,在http节点中插入server节点:
    server{
              listen 80;
              server_name MyTest;
              location ~ {
                   root /usr/share/nginx/www/MyTest/;
                   index Default.aspx default.aspx index.aspx Index.aspx index.html index.htm default.htm;
                   fastcgi_index Default.aspx;
                   fastcgi_pass 127.0.0.1:9000;
                   fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                   include /etc/nginx/fastcgi_params;
              }
         }
    • 编辑/etc/nginx/fastcgi_params,加入fastcgi_param PATH_INFO ""; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    • 执行sudo /etc/init.d/nginx restart,重启nginx;
    • 执行sudo fastcgi-mono-server4 /applications=/:/usr/share/nnx/www/MyTest /socket=tcp:127.0.0.1:9000,让mono fastcgi开始侦听9000端口上的请求;
    • 将/usr/share/nginx/www/index.html改名或者删除,这样nginx解析localhost时不会返回默认的index.html页面,此时再访问http://localhost/应该就能看到mvc程序默认的Home/Index中的界面了
  • 相关阅读:
    ArcGIS engine中Display类库 (局部刷新)
    ArcGIS 空间查询一例
    反射方法获取事件的委托链上的函数
    [转] 基于C#的波形显示控件的实现
    C# 对Excel操作时,单元格值的读取
    44.Node.js Express 框架--web框架
    43.安装npm及cnpm(Windows)
    42.cnpm不是内部命令的解决方案:配置环境变量
    41.Node.js使用cnpm
    40.Node.js Web 模块
  • 原文地址:https://www.cnblogs.com/jiangdaoli/p/2976353.html
Copyright © 2011-2022 走看看