




版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認領(lǐng)
文檔簡介
nginx負載均衡實現(xiàn)、拓撲巨聯(lián)網(wǎng)I四inx負載均衢器IP192.168巨聯(lián)網(wǎng)I四inx負載均衢器IP192.1681250梆"服旁器L-fIP:51受換機WE成服務(wù)器IP192.1681.2625linuxsfj.con、安裝軟件wgethttp://nginx.Org/download/nginx-1.0.11.tar.gzwgetftp://ftp.csx.cam.ac.Uk/pub/software/programming/pcre/pcre-8.21.tar.gz1、 安裝pcretarzxvfpcre-8.21.tar.gzcdpcre-8.21./configuremake&&makeinstall2、 安裝nginxtarzxvfnginx-1.0.11.tar.gzcdnginx-1.0.11useradd-s/sbin/nologinwww./configure--user=www--group=www--prefix=/usr/local/nginx--with-httpstubstatusmodule--with-http_ssl_modulemakemakeinstall三、配置nginxcd/usr/local/nginx/cpnginx.confnginx.conf.bakvinginx.conf###############################################################################userwwwwww;worker_processes1;error_log/usr/local/nginx/logs/nginx_error.logcrit;pid /usr/local/nginx/nginx.pid;worker_rlimit_nofile51200;##############################################################################events(useepoll;worker_connections51200;}##############################################################################http(includemime.types;default_typeapplication/octet-stream;sendfileon;tcp_nopushon;keepalivetimeout60;tcp_nodelayon;##############################################################################upstream50(server51;server52;}##############################################################################server(listen80;server_name*.;location/(proxy_pass http://192.168.L250;proxy_set_header Host $host;proxy_set_header X-Real-IP $remote_addr;proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;}location/nginx_status(stub_statuson;access_logoff;allow53;denyall;}###############################################################################logformatwww_test_com'$remote_addr-$remote_user[$time_local]$request''〃$status〃$body_bytes_sent〃$http_referer〃''〃$http_user_agent〃〃$http_x_forwarded_for〃';access_log/usr/local/nginx/logs/nginx.logwww_test_com;}}################################################################################四、 測試配置是否正常[root@linux-1conf]#/usr/local/nginx/sbin/nginx-tnginx:theconfigurationfile/usr/local/nginx/conf/nginx.confsyntaxisoknginx:configurationfile/usr/local/nginx/conf/nginx.conftestissuccessful############################以上說明配置正確###################五、 啟動和停止nginx負載均衡器啟動:ulimit-SHn51200/usr/local/nginx/sbin/nginx停止:killall-9nginx####注意nginx可以寫腳本形式讓它啟動停止六、 測試web1 >ip:51 >index.html >theisweb1web2 >ip:52 >index.html >theisweb2測試結(jié)果:
七、簡單的使用監(jiān)控模塊(沒有像LVS的ipvsadm強大,只是簡單的查看而已)http://192.168.L250/nginx_status/OlS216&1.250/nginx_&Uti i?50/nginx&tatusActiveconnections:2.serveracceptshandledrequest^2S291012.Reading::0Writing:1Waiting:1##########################到些簡單的負載配置完成#######################八、簡單講解配置文件(講解有錯誤請指教):worker_processes1;###一般配置跟CPU的數(shù)量一樣error_log/usr/local/nginx/logs/nginx_error.logcrit;###nginx錯誤日志使用useepoll;###epoll模式worker_connections51200;###每個進程最大連接數(shù)51200個upstream50(server51;server52;}###############這個就是負載了,下面的就是后端的源服務(wù)器location/(proxy_pass 50;proxy_set_header Host $host;proxy_set_header X-Real-IP $remote_addr;proxy_set_headerX-Forwarded-For$proxy_add_x_forwarded_for;}##########后端源Web服
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 農(nóng)村衛(wèi)浴維修合同范本
- 專業(yè)護欄安裝合同范本
- 住建部合同范本0204
- 北京農(nóng)村土地租賃合同范本
- 兼職app推廣合同范本
- 交房質(zhì)量糾紛合同范本
- 公司貸款抵押合同范本
- 全國青島版信息技術(shù)七年級下冊專題二第6課《閱讀材料 濾鏡》教學(xué)設(shè)計
- 包裝木箱合同范本
- 劇團戲服贈與合同范本
- 建設(shè)工程質(zhì)量檢測方案-技術(shù)標(biāo)部分
- 大學(xué)英語詞匯表(5500)個單詞
- 駕駛員疲勞駕駛監(jiān)測系統(tǒng)
- 裝飾公司項目融資計劃書
- 《憲法學(xué)》2023-2024期末試題及答案(試卷號2106)
- 護士服裝文化與護理課件
- 2023年建筑業(yè)10項新技術(shù)
- 遼寧省沈陽市名校2024屆中考數(shù)學(xué)全真模擬試題含解析
- DB5105T 63-2023合江真龍柚生產(chǎn)技術(shù)規(guī)程
- 一崗雙責(zé)評價細則范本
- 古典文獻的校勘(下)
評論
0/150
提交評論