Ubuntu Server Nginx 下配置 mono 下運行 asp.net mvc

來源:互聯網
上載者:User
OS: Ubuntu 9.10WebServer: Nginx 0.7.62 + mono-fastcgi-server2environment: movo 2.05 + asp.net 2.05 + asp.net mvc 1.0DbServer: MySql Server 5.1以下是步驟:1.安裝Ubuntu 9.10(廢話)2.安裝Mono(由於Ubuntu 9.10已經內建了最新版的Mono,所以這一步省了)3.安裝Nginxsudo apt-get install nginx4.安裝fastcgi-mono-serversudo apt-get install mono-fastcgi-server25.配置Nginxa.以root進入/etc/nginxb.用gedit開啟nginx.confc.在檔案中的http節點最後添加:server {listen80;server_namelocalhost;location ~ {root /ver/www; #網站的根目錄index Default.aspx default.aspx index.aspx Index.aspx index.html index.htm default.htm;fastcgi_pass127.0.0.1:9000; #fastcgi要監聽的連接埠號碼,與後面mono-fastcgi-server2要監聽的連接埠號碼要一至fastcgi_paramSCRIPT_FILENAME $document_root$fastcgi_script_name;include /etc/nginx/fastcgi_params;}}d.到網站根目錄,將/etc/nginx/sites-enabled下的default檔案複製過去(其實是連結過去的)e.開啟default檔案(以root),在其中的server節點下添加以下內容(就是上面的location節點):location ~ {fastcgi_pass127.0.0.1:9000; #fastcgi要監聽的連接埠號碼,與後面mono-fastcgi-server2要監聽的連接埠號碼要一至fastcgi_paramSCRIPT_FILENAME $document_root$fastcgi_script_name;include /etc/nginx/fastcgi_params;}location / {root /ver/www; #網站的根目錄index Default.aspx default.aspx index.aspx Index.aspx index.html index.htm default.htm;}f.開啟/etc/nginx下的fastcgi_params檔案,在最後加入以下內容(這個一定要加,不然mvc的路由功能就不起作用):fastcgi_paramPATH_INFO"";fastcgi_paramSCRIPT_FILENAME$document_root$fastcgi_script_name;g.至此nginx就算配置完了.6.啟動Servera.nginxsudo /etc/init.d/nginx start 或 restartb.mono-fastcgi-server2(很奇怪,安裝的時候和用的時候的名字是相反的), 下面/socket是監聽的連接埠, /address是本機IP, /application是網站相對路徑和相對應的程式的sudo fastcgi-mono-server2 /socket=tcp:9000 /address=127.0.0.1 /applications=/:/var/wwwc.瀏覽器中輸入http://localhost這時你程式程應該就能跑起來了.7.配置web.conf以使用MySql作為資料庫a.開啟web.configb.在前加入以下內容:<system.data><DbProviderFactories><clear /><add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient" description=".Net Framework Data Provider for MySQL" type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data" /></DbProviderFactories></system.data>c.這樣你就可以在asp.net中使用MySql作為資料庫了,MySql.Data.dll可以到MySql網站中下載,這裡就不細說了.8.如果你使用MySql中的MermberShip Provider作為你網站的使用者管理, 那你的程式可能還不能正常去行, 因為Mono現在還不提供Hased的密碼加密方式,所以你需要用到encrypted.a.將web.config中的memberShip > providers > add節點中的passwordFormat的值改為encryptedb.在&ltsystem.web>節點下加入以下內容, 其中的索引值你也可以用別的:<machineKey validationKey="B6AF9388159183B6A8EE690C851398A11997C519F859599459E30121EF4DF8BF2B1666BC82BB6FEB2FEF279BEB325E897AED6EA5B71C55D213B76510EF96CAA8" decryptionKey="3C5EF273A20ED2473594C9691627700A79376A7C1455320A" validation="SHA1" />c.這樣你的程式就可以使用MySql的MemberShipProvider了.
相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.