使用nginx+apache搭建负载均衡

 
更多

搭建环境:

两台centos。

主机一:192.168.1.6  安装nginx以及apche

主机二:192.168.1.7 安装apache

 

 

 

主机一配置:

配置阿里云的yum源:

wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

yum makecache

安装epel源

yum -y install epel*

安装nginx、apache

[root@6 yum.repos.d]# yum -y install nginx  httpd

写一个访问页面:

[root@6 ~]# echo “<h1>我是主机一。</h1>” > /var/www/html/index.html

root@6 ~]# systemctl restart httpd.service

访问:

[root@6 ~]# curl 192.168.1.6
<h1>我是主机一。</h1>

配置nginx:

[root@6 ~]# vim /etc/nginx/nginx.conf

 

 

 

[root@6 nginx]# systemctl restart nginx

 

 

 

 

主机二配置:

安装apache:

[root@7 ~]# yum -y install httpd

写一个访问页面:

[root@7 ~]# echo “<h1>我是主机二。</h1>” > /var/www/html/index.html
[root@7 ~]# systemctl restart httpd

访问是没问题的:

[root@7 ~]# curl 192.168.1.7

<h1>我是主机二。</h1>

 

 

测试:

刷新网页

 

打赏

本文固定链接: https://www.cxy163.net/archives/5297 | 绝缘体

该日志由 绝缘体.. 于 2020年03月08日 发表在 apache, html, nginx, 云服务商, 开发工具, 编程语言, 阿里云 分类下, 你可以发表评论,并在保留原文地址及作者的情况下引用到你的网站或博客。
原创文章转载请注明: 使用nginx+apache搭建负载均衡 | 绝缘体
关键字: , , , ,

使用nginx+apache搭建负载均衡:等您坐沙发呢!

发表评论


快捷键:Ctrl+Enter