代理和反向代理的概念
代理:找别人代替你去完成一件你完不成的事(代购),代理的对象是客户端
反向代理:替厂家卖东西的人就叫反向代理(烟酒代理) ,代理的对象是服务器端
1、在另一台主机安装apache作为测试机,关闭防火墙、SElinux
yum install -y httpd
echo "This is a test machine" >/var/www/html/index.html
systemctl start httpd
2、在nginx服务器配置文件中某一server标签中添加
location / {
proxy_pass http://192.168.66.20:80; # apache 服务器的 IP 地址
}
3、重启nginx,使用客户端访问nginx服务器测试