例子1:-------------------------
upstream backend {
server backend1.example.com weight=5;
server backend2.example.com:8080;
server unix:/tmp/backend3;
}
server {
location / {
_pass
}
}
例子2:-----------------------------
http {
upstream myproject {
server 127.0.0.1:8000 weight=3;
server 127.0.0.1:8001;
server 127.0.0.1:8002;
server 127.0.0.1:8003;
}
server {
listen 80;
server_name;
location / {
proxy_pass
}
}
}
例子3:-----------------------------
upstream sitename {
server 127.0.0.1:4000;
server 127.0.0.1:4001;
}
server {
listen 80;
server_name;
rewrite^(/.*)$1 permanent;
}
server {
listen 80;
server_name sitename.com;
location / {
proxy_pass
}
}
阅读(876) | 评论(0) | 转发(0) |