#配置负载均衡池
#Demo1负载均衡池
upstream linux_pool{
server 127.0.0.1:8001;
}
#Demo2负载均衡池
upstream m_pool{
server 127.0.0.1:8002;
}
#Demo1端口转发
server {
listen 80;
server_name linux.linuxidc.com;
access_log logs/linux.log;
error_log logs/linux.error;
#将所有请求转发给demo_pool池的应用处理 location / { proxy_set_header Host $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_pass http://linux_pool; }
}
#Demo2端口转发
server {
listen 80;
server_name m.linuxidc.com;
access_log logs/m.log;
error_log logs/m.error;
#将所有请求转发给demo_pool池的应用处理 location / { proxy_set_header Host $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_pass http://m_pool; }
}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)