搭建nginx负载均衡服务器
负载均衡服务器
Nginx的反向代理功能配置一个nginx负载均衡服务器,后端有三个服务节点,提供web服务。
搭建环境:
系统redhat系统5.4
(1)搭建前准备:
四台linux主机
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搭建负载均衡
注明:
在这里主要介绍nginx使用,以上几台请参考其它配置文件来做。
再要搭建nginx负载时首先做好域名解析:注明:其他三个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:负载均衡服务器,搭建nginx负载均衡服务器
版权声明:本站文章来源标注为YINGSOO的内容版权均为本站所有,欢迎引用、转载,请保持原文完整并注明来源及原文链接。禁止复制或仿造本网站,禁止在非www.yingsoo.com所属的服务器上建立镜像,否则将依法追究法律责任。本站部分内容来源于网友推荐、互联网收集整理而来,仅供学习参考,不代表本站立场,如有内容涉嫌侵权,请联系alex-e#qq.com处理。