多多色-多人伦交性欧美在线观看-多人伦精品一区二区三区视频-多色视频-免费黄色视屏网站-免费黄色在线

國(guó)內(nèi)最全I(xiàn)T社區(qū)平臺(tái) 聯(lián)系我們 | 收藏本站
阿里云優(yōu)惠2
您當(dāng)前位置:首頁(yè) > php框架 > 框架設(shè)計(jì) > 使用Nginx負(fù)載均衡搭建高性能.NETweb應(yīng)用程序二

使用Nginx負(fù)載均衡搭建高性能.NETweb應(yīng)用程序二

來(lái)源:程序員人生   發(fā)布時(shí)間:2015-01-16 08:17:11 閱讀次數(shù):3266次

在文章《使用Nginx負(fù)載均衡搭建高性能.NETweb利用程序1》中,讓我們對(duì)Nginx有了1個(gè)初步認(rèn)識(shí),下面我們將在windows平臺(tái)下面使用Nginx演示集群部署我們的web利用。


1、下載Nginx部署包

到Nginx官網(wǎng)去下載1個(gè)windows平臺(tái)下面的Nginx部署包,目前我下載的是1個(gè)nginx⑴.6.2版本的。


2、命令啟動(dòng)服務(wù)
啟動(dòng):start nginx.exe
停止:nginx -s stop

重新加載: nginx -s reload


3、實(shí)例搭建
首選:我們要在我們的iis上面把我們做好的web利用部署上去,部署到不同的機(jī)器上面,設(shè)置好對(duì)應(yīng)的ip和端口號(hào),由于我在本機(jī)摹擬出效果,所以我就在本機(jī)的iis上臉部署了2個(gè)web利用,第1個(gè)web利用部署在localhost:8011端口,第2個(gè)利用部署為localhost:8012端口,同時(shí)為了看到演示效果,我們把里面的WebForm1.aspx頁(yè)面做了1個(gè)標(biāo)記,里面標(biāo)記為:第幾個(gè)web利用程序的頁(yè)面,實(shí)際我們部署系統(tǒng),不需要這樣做,就是把我們的1個(gè)web利用部署到不同機(jī)器上面的服務(wù)器上,下面所示。

web利用1地址:http://localhost:8011/WebForm1.aspx
web利用2地址:http://localhost:8012/WebForm1.aspx

(1)啟動(dòng)Nginx服務(wù)

2)修改Nginx配置項(xiàng),具體配置說(shuō)明,我們?cè)趨?shù)設(shè)置部門(mén)說(shuō)明,然后驗(yàn)證服務(wù)是不是正常啟動(dòng)。

3)訪問(wèn)地址http://localhost:8010/WebForm1.aspx視察結(jié)果

 


(4)這樣我們就能夠摹擬出負(fù)載均衡效果了,ok

4、其他說(shuō)明

(1)配置域名訪問(wèn):首先我們要在Nginx中添加域名設(shè)置,其次我們要在本機(jī)設(shè)置127.0.0.1映照為域名

這樣我們就能夠這樣訪問(wèn)了:http://huangxiang:8010/WebForm1.aspx

(2)配置Ngnix啟動(dòng)的進(jìn)程數(shù)量,我們可以在進(jìn)程中關(guān)注其進(jìn)程數(shù)量變化


5、參數(shù)設(shè)置

#定義Nginx運(yùn)行的用戶和用戶組 #user nobody; #Nginx進(jìn)程數(shù),建議和cpu總內(nèi)核1致 worker_processes 2; #error_log logs/error.log; #error_log logs/error.log notice; #error_log logs/error.log info; #pid logs/nginx.pid; events { #定義單個(gè)進(jìn)程的最大連接數(shù)(實(shí)際最大連接數(shù)要除以2) worker_connections 1024; } #定義http服務(wù)器 http { include mime.types;#定義文件擴(kuò)大名和文件類型映照表 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; #服務(wù)器的集群 upstream huangxiang.com { #服務(wù)器集群名字 #server 172.16.21.13:8081 weight=1;#服務(wù)器配置 weight是權(quán)重的意思,權(quán)重越大,分配的幾率越大。 #server 192.168.1.186:8081 weight=1; #server 172.16.1.14:8081 weight=2; #server 172.16.1.15:8081 weight=1; #server 172.16.1.15:80 weight=1; server 127.0.0.1:8011 weight=1; server 127.0.0.1:8012 weight=2; } #虛擬機(jī)主機(jī)配置 server { listen 8010;#端口號(hào) server_name localhost huangxiang.com;#域名可以有多個(gè),多個(gè)用空格分開(kāi) #charset koi8-r; #access_log logs/host.access.log main; #location / { # root html; # index index.html index.htm; #} location / { proxy_pass http://huangxiang.com; proxy_redirect default; } #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 ssl; # server_name localhost; # ssl_certificate cert.pem; # ssl_certificate_key cert.key; # ssl_session_cache shared:SSL:1m; # ssl_session_timeout 5m; # ssl_ciphers HIGH:!aNULL:!MD5; # ssl_prefer_server_ciphers on; # location / { # root html; # index index.html index.htm; # } #} }



生活不易,碼農(nóng)辛苦
如果您覺(jué)得本網(wǎng)站對(duì)您的學(xué)習(xí)有所幫助,可以手機(jī)掃描二維碼進(jìn)行捐贈(zèng)
程序員人生
------分隔線----------------------------
分享到:
------分隔線----------------------------
關(guān)閉
程序員人生
主站蜘蛛池模板: 欧美午夜在线观看 | 欧美精品一区二区在线观看 | jizz日本护士视频 | 午夜啪啪网| 欧美日本一级在线播放 | 99久久精品一区二区三区 | 欧美18videossex性欧美 | 最新jizz 欧美 | 日本一区二区三区四区不卡 | 本地毛片 | 日本亚洲高清 | 亚洲色图1 | 操人网| 亚洲天堂久 | 国产福利片在线 易阳 | 欧美黑人xxxx猛战黑人 | 日本成人在线播放 | 国产成人综合亚洲亚洲欧美 | 国产成人福利美女观看视频 | 最新中文字幕av专区 | 成年人免费看视频 | 手机看片福利日韩 | 欧美在线视频 一区二区 | 国产精品二区高清在线 | 一级国产20岁美女毛片 | 都市激情校园春色亚洲 | 一级做a爰片性色毛片刺激 一级做a爰片性色毛片黄书 | 久久99久久99精品免观看麻豆 | 国产中文字幕视频 | 91丨九色丨首页在线观看 | 亚洲十八精品网站 | 国产精品视频一区二区三区w | 国产乱码精品一区二区三区四川 | aⅴ在线免费观看 | 亚州精品永久观看视频 | 一区二区三区 | 中文国产成人精品久久一区 | 久久天堂影院 | 国产欧美日韩高清专区手机版 | 午夜在线视频免费 | 亚洲伊人精品 |