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中的界面了
  • 相关阅读:
    background-position 使用方法具体介绍
    Android平台上直接物理内存读写漏洞的那些事
    自己编写高负荷測试的工具
    String,StringBuffer与StringBuilder的差别??
    shell之here文档
    心跳检测的思路及代码
    高可用架构篇--MyCat在MySQL主从复制基础上实现读写分离
    MySQL主从复制之Mycat简单配置和高可用
    Mycat 读写分离+分库分表
    MyCat:对MySQL数据库进行分库分表
  • 原文地址:https://www.cnblogs.com/jiangdaoli/p/2976353.html
Copyright © 2011-2022 走看看