Nginx反向代理和负载均衡原文
Nginx负载均衡案例
主机 | Ip | 安装 | 系统 |
---|---|---|---|
Nginx | 192.168.40.99 | Nginx | RHEL8/CentOS8 |
Rs1 | 192.168.100.100 | Httpd | RHEL8/CentOS8 |
Rs2 | 192.168.100.101 | Httpd Tomcat | RHEL8/CentOS8 |
关闭三台防火墙和selinux
# systemctl status firewalld.service
● firewalld.service - firewalld - dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
Active: inactive (dead)
Docs: man:firewalld(1)
[root@nginx ~]# getenforce
Disabled
配置yum源配置yum源
cd /etc/yum.repos.d/
wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-vault-8.5.2111.repo
yum install -y https://mirrors.aliyun.com/epel/epel-release-latest-8.noarch.rpm
源码部署nginx
创建nginx服务用户
[root@nginx ~]# useradd -r -M -s /sbin/nologin nginx
[root@nginx ~]# id nginx
uid=975(nginx) gid=974(nginx) 组=974(nginx)
安装依赖环境
[root@nginx ~]# dnf -y install pcre-devel openssl openssl-devel gd-devel gcc gcc-c++ make
[root@nginx ~]# dnf -y groups mark install 'Development Tools'
上次元数据过期检查:0:13:17 前,执行于 2022年10月09日 星期日 23时39分57秒。
依赖关系解决。
=============================================================================================================
软件包 架构 版本 仓库 大小
=============================================================================================================
安装组:
Development Tools
事务概要
=================================================