Windows 下 Nginx+Mono 部署 Net

首先下载nginx软件   网站:http://nginx.org/en/download.html

我下载的是Stable version nginx/Windows-1.4.1 (稳定版本) 下载后解压默认c盘 。

运行dos命令窗口(也可以双击nginx.exe) 我们还是使用命令吧! 毕竟nginx在liunx系统下 都是执行命令 就当感受下吧!

输入cmd 进入解压后的nginx目录后 输入命令 start nginx如图:

这个打开浏览器输入localhost  如果出现下面的页面说明成功了!

然后去下载 mono软件 地址http://www.go-mono.com/mono-downloads/download.html

下载后安装(下一步和普通软件一样) 安装结果后如果:

运行画圈的 输入命令 fastcgi-mono-server2 /applications=/:. /socket=tcp:127.0.0.1:9000 /port=8000 /root="K:\cs"

root 后面对应的是你项目对应的路劲。

这个时候还要配置nginx的nginx.conf文件。

具体的如下:

#user  nobody;
worker_processes  1;

#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

#pid        logs/nginx.pid;


events {
    worker_connections  1024;
}


http {
    include       mime.types;
    default_type  application/octet-stream;

    #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
    #                  '$status $body_bytes_sent "$http_referer" '
    #                  '"$http_user_agent" "$http_x_forwarded_for"';

    #access_log  logs/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65;

    #gzip  on;

    server {
        listen       8000;
        server_name  localhost;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;

        location / {
            #root   html;
            #index  index.html index.htm;
            #占位符 等下要修改的地方!
        }

        #error_page  404              /404.html;

        # redirect server error pages to the static page /50x.html
        #
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }

        # proxy the PHP scripts to Apache listening on 127.0.0.1:80
        #
        #location ~ \.php$ {
        #    proxy_pass   http://127.0.0.1;
        #}

        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
        #
        #location ~ \.php$ {
        #    root           html;
        #    fastcgi_pass   127.0.0.1:9000;
        #    fastcgi_index  index.php;
        #    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
        #    include        fastcgi_params;
        #}

        # deny access to .htaccess files, if Apache's document root
        # concurs with nginx's one
        #
        #location ~ /\.ht {
        #    deny  all;
        #}
    }


    # another virtual host using mix of IP-, name-, and port-based configuration
    #
    #server {
    #    listen       8000;
    #    listen       somename:8080;
    #    server_name  somename  alias  another.alias;

    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}


    # HTTPS server
    #
    #server {
    #    listen       443;
    #    server_name  localhost;

    #    ssl                  on;
    #    ssl_certificate      cert.pem;
    #    ssl_certificate_key  cert.key;

    #    ssl_session_timeout  5m;

    #    ssl_protocols  SSLv2 SSLv3 TLSv1;
    #    ssl_ciphers  HIGH:!aNULL:!MD5;
    #    ssl_prefer_server_ciphers   on;

    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}
}

在红色的地方加入:

            root K:\cs;
            index index.html index.htm default.aspx Default.aspx; 
            fastcgi_index Default.aspx; 
            fastcgi_pass 127.0.0.1:9000; 
            include fastcgi_params; 
            fastcgi_param  PATH_INFO          "";
            fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;

其中root 后面的是指项目所在目录。

(关于nginx的配置 解释网上都有 不过我说的是这个方式有点像node.js的那个开启服务的语法  呵呵想多了)

最后运行结果:

这样asp.net  终于脱离了iis了   呵呵! 当然这里只是简单的介绍了 !详细的当然的还是谷歌大神了!

最后 在iteye 看 别人回答 一个关于 高并发的处理 回答 通俗又好  这里也借花献佛!

你需要了解大数据高并发的瓶颈在哪里,一般都是数据库层面的,机械硬盘承载不起非常快速的读写操作,cpu承载不起大量的逻辑运算,所以最基本的解决思路就是:
1.换固态硬盘加快硬盘的读写效率。
2.建立缓存中间件降低对硬盘的读写次数,缓存不用多说了,最最最基本和重要的优化策略。
3.将硬盘的读写或者数据的计算分摊到多台机器上,也就是集群。hadoop就是基于这个层面的。
4.良好的查询算法,降低读的次数,分表,分库,索引等都是基于这层面的。

理论上来讲,在带宽充裕的情况下,只要遵循上面的4个思路进行延伸就可以解决大部分的高并发问题。

哎!辞职的时候 正好5月份  貌似今年行情不好!深圳的一般最佳时机2-4 虽然别人和我说了  但是我还是想自己能力好 什么xx 不在乎  it有的时候真的很累 也行心态很重要吧! 

原文地址:https://www.cnblogs.com/y112102/p/3081554.html