码迷,mamicode.com
首页 > 其他好文 > 详细

HAProxy-1.8.20 根据后缀名转发到后端服务器

时间:2020-04-25 23:42:52      阅读:69      评论:0      收藏:0      [点我收藏+]

标签:class   -keep   后缀名   lan   prot   back   end   option   ISE   

global
maxconn 100000
chroot /data/soft/haproxy
stats socket /var/lib/haproxy/haproxy.sock mode 600 level admin
uid 1000
gid 1000
daemon
nbproc 2
cpu-map 1 0
cpu-map 2 1
pidfile /usr/local/haproxy/run/haproxy.pid
log 127.0.0.1 local3 info
defaults
  option http-keep-alive
  option  forwardfor # ip地址透传 针对http 协议有效
  maxconn 100000
  mode http
  timeout connect 300000ms
  timeout client  300000ms
  timeout server  300000ms

################   重点配置   ################
frontend web_prot_80
  bind 0.0.0.0:80
  mode http

  acl image_port  path_end -i .jpg 
  acl php_port  path_end -i .php

  use_backend image_nodes if image_port
  use_backend php_nodes if php_port
  default_backend backup_nodes

backend image_nodes 
  server server1  10.10.29.207:80 weight 1 check port 80 inter 3s fall 2 rise 5

backend php_nodes 
  server server2  10.10.4.209:80  weight 1 check port 80 inter 3s fall 2 rise 5

backend backup_nodes 
  server server3  10.10.116.206:80 weight 1 check port 80 inter 3s fall 2 rise 5

HAProxy-1.8.20 根据后缀名转发到后端服务器

标签:class   -keep   后缀名   lan   prot   back   end   option   ISE   

原文地址:https://www.cnblogs.com/zhenxing06/p/12775809.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!