负载均衡算法
动静分离
web项目:前端(静态网页)+后端(动态网页)
1、nginx 代理+location匹配+负载均衡
看用户的请求,如果请求的静态资源,调到nginx用户的请求是动态资源,调到动态服务器
1、
web1静态资源(安装运行nginx(web))
静态网页放到web-1运行(hello world)
web2
nginx与php关联()
1.18版本
删了#
新版本
vi /etc/nginx/conf.d/default.conf
重启nginx :systemctl restart nginx
第三台:安装nginx实现动静分离
(代理+负载均衡+location+正则表达)
子配置文件:
重启nginx
访问
静态加图片,可访问
视频nginx10
查看php版本
防盗链
227
重启
[root@a web]# vim index.html
<html>
<head>
<meta charset="utf-8">
<title>qf.com</title>
</head>
<body>
<center><img src="../1.JPG" alt="xingdian" width="500px" height="900px" /></center>
</body>
</html>
250
防盗链
227
vim /etc/nginx/nginx.conf
vim /etc/nginx/conf.d/default.conf
重新启动服务: nginx -s reload