负载均衡
[root@localhost ~]# vim /usr/local/nginx/conf/nginx.conf
upstream zzl.com {
server 192.168.20.135 weight=2;
server 192.168.20.120 weight=1;
}
下面这个要写在server字段里面
location / {
proxy_pass http://zzl.com;
}
[root@localhost ~]# nginx -s reload
动静分离
//静态
upstream static.com {
server 192.168.20.135 weight=2;
server 192.168.20.120 weight=1;
}
//动态
upstream danamic.com {
server 192.168.20.99 weight=1;
}
location / {
root html;
index index.html index.htm;
proxy_pass http://static.com;
}
location ~ \.php$ {
proxy_pass http://danamic.com;
}