Let ASP fly on a Mac

Source: Internet
Author: User
<span id="Label3"></p><p class="p1"><p class="p1">. NET Non-cross-platform has been controversial, although Microsoft's front-end time to release some information to Support. NET Cross-platform development, But Microsoft has been adhering to the non-active, non-rejection, irresponsible three attitude, still use a software empire mentality, tossing some nothing new. Microsoft wants to regain the respect and recognition of the public, must discard some traditional ideas, actively listen to the voice of developers, and developers stand together to develop together, and this seems to be a long way to go.</p></p><p class="p1"><p class="p1">Cross-platform is a trend, in the end, Microsoft has to BOW. Mono has been in Microsoft's white right now, and now it's pretty good, although it can't support all the features of The. NET Framework, but it's enough for us now that it already supports C # 4.0, ASP 4, and many open source components that are compatible with mono Framework as an important indicator.</p></p><p class="p1"><p class="p1">As an enterprise, to reduce the cost of hardware equipment is to implement a set of software system priorities to consider things, many enterprises in order to save costs, have to choose some other low-cost programming language, such as java, php, which is also some of the Garden. neter consciously inferior The important reason, is also Javaer often scold. net common means, with mono, you can build a cheaper solution, let those pretend, despise your people to die.</p></p><p class="p1"><p class="p1">Today I'm going to move the ASP to Mac.</p></p><p class="p1"><p class="p1">We all know that the ASP can not run alone, it must be hosted on the Web application server, on Windows We are basically iis,iis very powerful, management is convenient, on the Mac we can not install IIS, but we also have other tools, because no matter what Web application services They all have the same principle of listening to HTTP requests, and then mapping and forwarding requests to the corresponding handlers based on the routing rules we Set.</p></p><p class="p1"><p class="p1">There are many application servers that support mono, such as Apache,nginx.</p></p><p class="p1"><p class="p1">Apache doesn't have to say much, the Java world on the tall is something that everyone knows, but I use Nginx today. Nginx typically combines keepalive for load balancing, But it is also a very powerful HTTP Server.</p></p><p class="p1"><p class="p1">First step, download:</p></p><p class="p1"><p class="p1"><span style="line-height: 1.5;">Click here to download nginx. I choose here is 1.2.9 version, The latest is 1.7.1, do not ask me why I do not use the latest version, because I loaded from 1.4.0 to 1.7.1, not once in my Mac installed success, I do not want to toss, the Killing.</span></p></p><p class="p1"><p class="p1"><span style="line-height: 1.5;">The second step, unzip:</span></p></p><p class="p1"><p class="p1"><span style="line-height: 1.5;">Download ok, we go into the downloads directory extract:</span></p></p><p style="margin-left: 30px;" class="p1"><p style="margin-left: 30px;" class="p1"><span style="line-height: 1.5;">zhaoguihuadediannao:/zhaogh$ CD ~/download</span></p></p><p style="margin-left: 30px;" class="p1"><p style="margin-left: 30px;" class="p1">Zhaoguihuadediannao:downloads zhaogh$ Tar nginx-1.2.9.tar.gz</p></p><p class="p1"><p class="p1">Step three, Pre-installation Configuration</p></p><p style="margin-left: 30px;" class="p1"><p style="margin-left: 30px;" class="p1">Zhaoguihuadediannao:downloads zhaogh$ CD nginx-1.2.9</p></p><p style="margin-left: 30px;" class="p1"><p style="margin-left: 30px;" class="p1">zhaoguihuadediannao:nginx-1.2.9 zhaogh$ Sudo./configure--prefix=/usr/local--with-http_ssl_module</p></p><p class="p1"><p class="p1">This is mainly the installation path of the specified nginx.</p></p><p class="p1"><p class="p1">Fourth step, compile and install</p></p><p style="margin-left: 30px;" class="p1"><p style="margin-left: 30px;" class="p1">zhaoguihuadediannao:nginx-1.2.9 zhaogh$ sudo make</p></p><p style="margin-left: 30px;" class="p1"><p style="margin-left: 30px;" class="p1">zhaoguihuadediannao:nginx-1.2.9 zhaogh$ sudo make install</p></p><p class="p1"><p class="p1">Fifth step, run the test</p></p><p style="margin-left: 30px;" class="p1"><p style="margin-left: 30px;" class="p1">zhaoguihuadediannao:nginx-1.2.9 zhaogh$ Cd/usr/local/sbin</p></p><p style="margin-left: 30px;" class="p1"><p style="margin-left: 30px;" class="p1">Zhaoguihuadediannao:sbin zhaogh$ Sudo./nginx</p></p><p class="p1"><p class="p1">In the browser open http://localhost/, if you can see the following words, then I would like to congratulate you, your efforts have not wasted, brother saw your growth and progress, can brother's hard and a few people see, I for this several words toss for a long time.</p></p>Welcome to nginx!<p><p>We want to do the ASP. net program can be run on nginx, the light above a few steps not yet, we have to do some basic configuration.</p></p><p class="p1"><p class="p1">Sixth step, Editing the configuration</p></p><p class="p1"><p class="p1">Open nginx.conf file with VI</p></p><p style="margin-left: 30px;" class="p1"><p style="margin-left: 30px;" class="p1">zhaoguihuadediannao:~ zhaogh$ cd/usr/local/conf</p></p><p style="margin-left: 30px;" class="p1"><p style="margin-left: 30px;" class="p1">Zhaoguihuadediannao:conf zhaogh$ VI nginx.conf</p></p><p class="p1"><p class="p1">Modify the contents of the following color, others do not move:</p></p><p style="margin-left: 30px;"><p style="margin-left: 30px;">server {<br>Listen 80;<br>server_name localhost;</p></p><p style="margin-left: 30px;"><p style="margin-left: 30px;">#charset koi8-r;</p></p><p style="margin-left: 30px;"><p style="margin-left: 30px;">#access_log Logs/host.access.log main;</p></p><p style="margin-left: 30px;"><p style="margin-left: 30px;">location/{<br>Root html;<br><span style="color: rgb(255, 102, 0);">Index index.html index.htm Default.aspx default.aspx;</span><br><span style="color: rgb(255, 102, 0);">Fastcgi_index default.aspx;</span><br><span style="color: rgb(255, 102, 0);">Fastcgi_pass 127.0.0.1:9000;</span><br><span style="color: rgb(255, 102, 0);">include/usr/local/conf/fastcgi_params;</span><br>}</p></p><p class="p1"><p class="p1">Then modify The/usr/local/conf/fastcgi_params file, plus the following lines:</p></p><p style="margin-left: 30px;"><p style="margin-left: 30px;"><span style="color: rgb(255, 102, 0);"># mono</span><br><span style="color: rgb(255, 102, 0);">Fastcgi_param Path_info "";</span><br><span style="color: rgb(255, 102, 0);">Fastcgi_param script_filename $document _root$fastcgi_script_name;</span></p></p><p><p><span style="color: rgb(0, 0, 0);">Seventh step, start Fastcgi-mono-server:</span></p></p><p style="margin-left: 30px;" class="p1"><p style="margin-left: 30px;" class="p1">zhaoguihuadediannao:~ zhaogh$ fastcgi-mono-server2/applications=localhost:/:/projects/website//socket=tcp : 127.0.0.1:9000</p></p><p class="p1"><p class="p1">Remember to change this section of/projects/website/to your program directory, This program I am directly using the Xamarin template to do a web Application.</p></p><p class="p1"><p class="p1">Eighth step, start Nginx:</p></p><p style="margin-left: 30px;" class="p1"><p style="margin-left: 30px;" class="p1">zhaoguihuadediannao:conf zhaogh$ Sudo/usr/local/sbin/nginx-s quit</p></p><p style="margin-left: 30px;" class="p1"><p style="margin-left: 30px;" class="p1">zhaoguihuadediannao:conf zhaogh$ Sudo/usr/local/sbin/nginx</p></p><p style="margin-left: 30px;" class="p1"><p style="margin-left: 30px;" class="p1">Zhaoguihuadediannao:conf zhaogh$</p></p><p><p><span style="color: rgb(0, 0, 0);">Now we go to the browser to enter http://localhost/to see what results, there is a picture of the truth, never Fooled.</span></p></p><p><p></p></p><p><p>You can completely compile your asp. NET MVC program with xamarin, put it on the nginx to run, do not believe you can try. We also have to respond to the Party's call to use less or no Windows system, and later customers will tell you that. net is not a grade, you let him die.</p></p></span>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.