nginx的负载均衡
文章目录
1.以多台虚拟机作服务器
1.1 在不同的虚拟机上安装httpd服务
我这里采用3台虚拟机分别建立3台服务器:192.168.32.137、192.168.32.138、192.168.32.147。
在3台虚拟机服务器上安装httpd服务
#使用yum安装httpd服务
[root@node0-8 /]# yum install httpd -y
#开启httpd服务
[root@node0-8 /]# systemctl start httpd
[root@node0-8 /]# systemctl status httpd
● httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; vendor preset: disabled)
Drop-In: /usr/lib/systemd/system/httpd.service.d
└─php-fpm.conf
Active: active (running) since Mon 2022-12-05 23:34:13 CST; 8 months 7 days ago
1.2 在不同虚拟机所构建的服务端的默认路径下创建不同标识的文件
#查看httpd的配置文件所指向的网站主页文件路径
[root@node0-8 /]# vim /etc/httpd/conf/httpd.conf
</Directory>
# Further relax access to the default document root:
<Directory "/var/www/html">
#在/var/www/html路径下创建index.html文件,文件内容标识不同的服务器端
#在