server {
#监听端口
listen 80;
#ip或者域名
server_name localhost;
location / {
root html;
index index.html index.htm;
#反向代理
proxy_pass http://hello;
#设置超时时间
proxy_connect_timeout 1;
}
#静态文件
location /static {
root F:/nginxtest/;
autoindex on;
}
}
#负载均衡
upstream hello {
#可以设置轮询权重、iphash等等
server 192.168.1.120:9200;
server 192.168.2.6:9200;
}
}