#user nobody;
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
#负载均衡服务器列表
upstream localhost{
#服务器地址及相应权重 假设本地部署了两个相同项目 端口分别为80和81
server 127.0.0.1:80 weight=1;
server 127.0.0.1:81weight=3;
}
#代理服务器设置
server {
#监听端口
listen 801;
#虚拟主机名称,单域时默认即可
server_name localhost;
#代理设置
location / {
#代理地址
proxy_pass http://localhost;
root html;
index index.html index.htm;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}