linux程序配置文件格式,linux模范配置文件格式

模范配置文件

#---------------------------------------------------------------------

# Global settings

#---------------------------------------------------------------------

global

log 127.0.0.1   local3

maxconn 204800

chroot /usr/local/haproxy

user  haproxy

group haproxy

daemon

nbproc 1

pidfile /var/run/haproxy.pid

stats socket /usr/local/haproxy/stats

description haproxy server

#---------------------------------------------------------------------

# common defaults that all the 'listen' and 'backend' sections will

# use if not designated in their block

#---------------------------------------------------------------------

defaults

log     global

mode    http

maxconn 10000

option  httplog

option  httpclose

option  dontlognull

option  forwardfor      except 127.0.0.0/8

retries 3

option redispatch

option abortonclose

balance roundrobin

timeout http-request    10s

timeout queue           1m

timeout connect         10s

timeout client          1m

timeout server          1m

timeout http-keep-alive 10s

timeout check           10s

#---------------------------------------------------------------------

# use listen setting the haproxy status for site

#---------------------------------------------------------------------

listen admin_status     #设置haproxy监控状态

bind *:3030

mode http

log 127.0.0.1 local3 err

stats refresh 5s

stats uri /status     #监控状态页面访问url

stats realm www.skeryp.com

stats auth admin:admin

stats hide-version

stats admin if TRUE

#---------------------------------------------------------------------

# main listen which proxys to the backends

#---------------------------------------------------------------------

listen  www

bind *:80

maxconn 5000

mode http

log global

option httplog

option httpclose

option forwardfor

log         global

default_backend default   #设置默认访问页面

#定义当请求的内容是静态内容时,将请求转交给static server的acl规则

acl url_static path_beg  -i /static /images /img /javascript /stylesheets

acl url_static path_end  -i .jpg .gif .png .css .js .html

acl host_static hdr_beg(host)  -i img. video. download. ftp. imags. videos.

#定义当请求的内容是php内容时,将请求转交给php server的acl规则

acl url_php path_end     -i .php

#定义当请求的内容是.jsp或.do内容时,将请求转交给tomcat server的acl规则

acl url_jsp path_end     -i .jsp .do

#引用acl匹配规则

use_backend static_pool if  url_static or host_static

use_backend php_pool    if  url_php

use_backend tomcat_pool if  url_jsp

#定义后端backend server

backend static_pool

option  httpchk GET /index.html

server static1 192.168.0.247:80 cookie id1  check inter 2000 rise 2 fall 3

backend php_pool

option  httpchk GET /info.php

server php1 192.168.0.235:80 cookie id1 check inter 2000 rise 2 fall 3

backend tomcat_pool

option  httpchk GET /index.jsp

server tomcat1 192.168.0.238:8086 cookie id2 check inter 2000 rise 2 fall 3

#

backend default

mode http

option  httpchk GET /index.html

server default 192.168.0.127:80 cookie id1 check inter 2000 rise 2 fall 3 maxconn 5000

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值