2021-07-08

Nginx服务器学习

一、Nginx的简介

在这里插入图片描述

二、Nginx的正向代理和反向代理

在这里插入图片描述
在这里插入图片描述

三、负载均衡

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

四、Nginx在Linux下安装

下载安装包,上传到Linux的opt文件夹下
在这里插入图片描述
命令解压安装包
tar -zxvf nginx-1.20.1.tar.gz
在这里插入图片描述
执行配置文件 ./configure
在这里插入图片描述
执行make命令
在这里插入图片描述
make install

修改端口:
[root@localhost conf]# clear
[root@localhost conf]# cd …
[root@localhost nginx]# ls
client_body_temp conf fastcgi_temp html logs proxy_temp sbin scgi_temp uwsgi_temp
[root@localhost nginx]# firewall-cmd --zone=public --add-port=8181/tcp --permanent
success
[root@localhost nginx]# firewall-cmd --list-ports
8282/tcp 8080/tcp 5672/tcp
[root@localhost nginx]# systemctl restart firewalld.service
[root@localhost nginx]# firewall-cmd --list-ports
8282/tcp 8080/tcp 5672/tcp 8181/tcp
[root@localhost nginx]# ls
client_body_temp conf fastcgi_temp html logs proxy_temp sbin scgi_temp uwsgi_temp
[root@localhost nginx]# cd sbin
[root@localhost sbin]# ls
nginx
[root@localhost sbin]# ./nginx
[root@localhost sbin]#

将默认的80端口,修改成8181端口,访问该端口
在这里插入图片描述

五、nginx的常用命令

在这里插入图片描述
防护墙相关命令:
在这里插入图片描述

六、Nginx实战和总结

当开启多个服务后,客户端发送请求,需要自动打到某个服务器上,使用nginx的反向代理和负载均衡实现
代理本质就是通过nginx来管理请求,在nginx的conf中配置反向代理和负载均衡
在这里插入图片描述
upstream:负载均衡配置 指定好服务器的ip地址,weight 是访问权重, 相同是,是轮询 不同是权重轮询
location / : 反向代理配置 将上面指定的服务器,由nginx的location配置,反向代理,交由nginx来管理请求

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值