Nginx负载均衡集群 一、Nginx简介1、nginx介绍2、反向代理2.1 什么是代理服务器?2.2 为什么要使用代理服务器?2.3 反向代理 VS 正向代理 3、负载均衡3.1 什么是负载均衡? 二、Nginx
nginx是一款由俄罗斯程序员IGor Sysoev所开发轻量级的网页服务器、反向代理服务器以及电子邮件(IMAP/POP3)代理服务器。
Nginx具有高并发、占用系统资源少等特性。
在功能应用方面,Nginx不仅是一个优秀的WEB服务软件,还具有反向代理负载均衡功能和缓存服务功能
代理服务器,客户机在发送请求时,不会直接发送给目标主机,而是先发送给代理服务器,代理服务器接收客户寄的请求之后,再向主机发出,并接收目的主机返回的数据,存放在代理服务器的硬盘中,再发送给客户机。
负载均衡集群为企业提供了更为实用、性价比更高的系统解决方案。负载均衡集群使客户访问请求压力及负载可以在计算机集群中尽可能平均地分摊处理。客户访问请求负载通常包括应用程序处理负载和网络流量负载。这样的系统非常适合向使用同一组应用程序的大量用户提供服务。每个节点都可以承担一定的访问请求负载压力,并且可以实现访问请求在各节点之间动态分配,以实现负载均衡。
负载均衡集群运行时,一般通过一个或者多个前段负载均衡器将客户访问请求分发到后端的一组服务器上,从而达到整个系统的高性能和高可用性。
[root@nginx ~]# yum install make zlib zlib-devel GCc-c++ libtool openssl openssl-devel -y
[root@nginx src]# cd /usr/local/src/[root@nginx src]# wget http://downloads.sourceforge.net/project/pcre/pcre/8.35/pcre-8.35.tar.gz
[root@nginx src]# tar zxvf pcre-8.35.tar.gz
[root@nginx src]# cd pcre-8.35
[root@nginx pcre-8.35]# ./configure[root@nginx pcre-8.35]# make && make install
[root@nginx pcre-8.35]# pcre-config --version8.35
官网地址:http://nginx.org/
[root@nginx pcre-8.35]# cd /usr/local/src[root@nginx src]# wget http://nginx.org/download/nginx-1.6.2.tar.gz
[root@nginx src]# tar zxvf nginx-1.6.2.tar.gz
[root@nginx src]# cd nginx-1.6.2
[root@nginx nginx-1.6.2]# ./configure --prefix=/usr/local/webserver/nginx --with-http_stub_status_module --with-http_ssl_module --with-pcre=/usr/local/src/pcre-8.35[root@nginx nginx-1.6.2]# make && make install
[root@nginx nginx-1.6.2]# /usr/local/webserver/nginx/sbin/nginx -vnginx version: nginx/1.6.2
nginx安装完成
[root@nginx ~]# cd /usr/local/webserver/[root@nginx webserver]# tree nginxnginx├── conf│ ├── fastcgi.conf│ ├── fastcgi.conf.default│ ├── fastcgi_params│ ├── fastcgi_params.default│ ├── koi-utf│ ├── koi-win│ ├── mime.types│ ├── mime.types.default│ ├── nginx.conf│ ├── nginx.conf.default│ ├── scgi_params│ ├── scgi_params.default│ ├── uwsgi_params│ ├── uwsgi_params.default│ └── win-utf├── html│ ├── 50x.html│ └── index.html├── logs└── sbin └── nginx4 directories, 18 files
[root@nginx ~]# cd /usr/local/webserver/nginx/[root@nginx nginx]# ./sbin/nginx[root@nginx nginx]# ps -ef | grep nginxroot 11281 1 0 09:56 ? 00:00:00 nginx: master process ./sbin/nginxnobody 11282 11281 0 09:56 ? 00:00:00 nginx: worker processroot 11285 1615 0 09:56 pts/0 00:00:00 grep --color=auto nginx
nginx常用命令:
/usr/local/webserver/nginx/sbin
./nginx -s stop #停止
./nginx -s quit #退出
./nginx -s reload #重新加载
[root@nginx nginx]# systemctl stop firewalld[root@nginx nginx]# systemctl disable firewalldRemoved symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.[root@nginx nginx]# setenforce 0
来源地址:https://blog.csdn.net/weixin_50570068/article/details/126459012
--结束END--
本文标题: Nginx安装与配置详解
本文链接: https://www.lsjlt.com/news/376849.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
下载Word文档到电脑,方便收藏和打印~
2024-04-30
2024-04-30
2024-04-30
2024-04-29
2024-04-29
2024-04-29
2024-04-18
2024-04-17
2024-04-11
2024-04-08
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0