zoukankan      html  css  js  c++  java
  • Ubuntu(Linux) + mono + xsp4 + nginx +asp.net MVC3 部署

    折腾了一下,尝试用Linux,部署mvc3。

    分别用过 centos 和 ubuntu ,用ubuntu是比较容易部署的。

    操作步骤如下:

    一、终端分别如下操作

    sudo su  ->输入密码
    apt-get install nginx 
    apt-get install mono 
    apt-get install mono-fastcgi-server4

    安装过程中会出一些缺少包的问题。具体要看实际情况安装

    对pcre g++ zlib 都有依赖

    sudo apt-get install libpcre3 libpcre3-dev libpcrecpp0 libssl-dev zlib1g-dev g++

    二、nginx 配置

    default

    sudo vim /etc/nginx/sites-available/default

    更改成

    server {
        listen   80;
        server_name localhost;
        root  /var/www/;
    
        location / {
          root /var/www/;
          index index.html index.htm index.aspx default.aspx;
          fastcgi_index /Site;
          fastcgi_pass 127.0.0.1:8000;
          include /etc/nginx/fastcgi_params;
        }
    }

    启动路径改成 var/www,所以应该创建一个www的文件夹

    sudo mkdir /var/www

    建议更改一下权限吧,因为这个文件夹需要共享,进行远程部署

    sudo chmod 777 /var/www
    fastcgi_params
    sudo vim /etc/nginx/fastcgi_params

    最后插入以下两行

    fastcgi_param  PATH_INFO          "";
    fastcgi_param  SCRIPT_FILENAME    $document_root$fastcgi_script_name;

    三、启动服务

    通过共享,部署mvc3站点到www上,再启动服务

    sudo /etc/init.d/nginx start
    
    sudo fastcgi-mono-server4 /applications=/:/var/www/ /socket=tcp:127.0.0.1:8000

    按照以上操作,应该已经部署完成了。

    但,还有一些部署问题,需要导入mvc的dll支持,导入到站点bin文件夹中

    System.Data.dll
    System.Web.ApplicationServices.dll
    System.Web.DynamicData.dll
    System.Web.Helpers.dll
    System.Web.Mvc.dll
    System.Web.Routing.dll
    System.Web.WebPages.Deployment.dll
    System.Web.WebPages.dll
    System.Web.WebPages.Razor.dll

    dll路径分别是

    C:Program FilesMicrosoft ASP.NETASP.NET Web Pagesv1.0Assemblies
    
    System.Web.Helpers.dll
    
    System.Web.Razor.dll
    
    System.Web.WebPages.dll
    
    System.Web.WebPages.Razor.dll
    
    System.Web.WebPages.Deployment.dll
    
    Microsoft.Web.Infrastructure.dll
    
     
    
    C:Program FilesMicrosoft ASP.NETASP.NET MVC 3Assemblies
    
    System.Web.Mvc.dll 

    还有,数据库读取问题,使用的是mysql,需要导入

    MySql.Data.dll

    进入web.config,在<system.web>下插入

    <globalization culture="en-us" enableClientBasedCulture="false"/>

    好了一切完成。分享一下自己的部署经验,希望对大家有所帮助,祝你们部署一切顺利o(∩_∩)o 

     

    by:五加乘

     

  • 相关阅读:
    [译]Chapter 3 Understanding Controllers
    Effiective C# Item1 : 使用属性代替成员变量
    终于出版了
    《Thinking in UML》读书笔记之一
    【译】ClickOnce部署概述
    [译]Chapter 2 Building a Simple ASP.NET MVC Application
    开始翻译《Application Architecture Guide 2.0》
    [译]Chapter 1 An Introduction to ASP.NET MVC(1)
    [译]Chapter 1 An Introduction to ASP.NET MVC(3)
    Effective C# Item4:使用Conditional特性代替#if条件编译
  • 原文地址:https://www.cnblogs.com/cheng5x/p/3731772.html
Copyright © 2011-2022 走看看