搭建nginx負(fù)載均衡服務(wù)器
負(fù)載均衡服務(wù)器
Nginx的反向代理功能配置一個nginx負(fù)載均衡服務(wù)器,后端有三個服務(wù)節(jié)點,提供web服務(wù)。
搭建環(huán)境:
系統(tǒng)redhat系統(tǒng)5.4
(1)搭建前準(zhǔn)備:
四臺linux主機(jī)
DNS:192.168.1.150
web:192.168.1.121
web:192.168.1.125
web:192.168.1.126
nginx:192.168.1.120用nginx搭建負(fù)載均衡
注明:
在這里主要介紹nginx使用,以上幾臺請參考其它配置文件來做。
再要搭建nginx負(fù)載時首先做好域名解析:注明:其他三個web不需要做什么域名解析,
A記錄index.htm;
#}
error_page404/404.html;
#redirectservererrorpagestothestaticpage/50x.html
#
#error_page500502503504/50x.html;
#location=/50x.html{
#roothtml;
#}
#proxythePHPscriptstoApachelisteningon127.0.0.1:80
#
#location~\.php${
#proxy_pass127.0.0.1;
#}
#passthePHPscriptstoFastCGIserverlisteningon127.0.0.1:9000
#
#location~\.php${
#roothtml;
#fastcgi_pass127.0.0.1:9000;
#fastcgi_indexindex.php;
#fastcgi_paramSCRIPT_FILENAME/scripts$fastcgi_script_name;
#includefastcgi_params;
#}
#denyaccessto.htaccessfiles,ifApache'sdocumentroot
#concurswithnginx'sone
#
#location~/\.ht{
#denyall;
#}
}
#anothervirtualhostusingmixofIP-,name-,andport-basedconfiguration
#
#server{
#listen8000;
#listensomename:8080;
#server_namesomenamealiasanother.alias;
#location/{
#roothtml;
#indexindex.htmlindex.htm;
#}
#}
#HTTPSserver
#
#server{
#listen443;
#server_namelocalhost;
#sslon;
#ssl_certificatecert.pem;
#ssl_certificate_keycert.key;
#ssl_session_timeout5m;
#ssl_protocolsSSLv2SSLv3TLSv1;
#ssl_ciphersALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;
#ssl_prefer_server_cipherson;
#location/{
#roothtml;
#indexindex.htmlindex.htm;
#}
#}
http
{
upstream;
#root/web/wwwroot;
location/{
proxy_pass
Tags:負(fù)載均衡服務(wù)器,搭建nginx負(fù)載均衡服務(wù)器
版權(quán)聲明:本站文章來源標(biāo)注為YINGSOO的內(nèi)容版權(quán)均為本站所有,歡迎引用、轉(zhuǎn)載,請保持原文完整并注明來源及原文鏈接。禁止復(fù)制或仿造本網(wǎng)站,禁止在非maisonbaluchon.cn所屬的服務(wù)器上建立鏡像,否則將依法追究法律責(zé)任。本站部分內(nèi)容來源于網(wǎng)友推薦、互聯(lián)網(wǎng)收集整理而來,僅供學(xué)習(xí)參考,不代表本站立場,如有內(nèi)容涉嫌侵權(quán),請聯(lián)系alex-e#qq.com處理。
關(guān)注官方微信