Haproxy實現80連接埠複用,haproxy80複用

來源:互聯網
上載者:User

Haproxy實現80連接埠複用,haproxy80複用

著作權聲明:

本文作者為—陳鑫

本文的所有內容均來陳鑫總結,未經本人許可,禁止私自轉寄及使用。

QQ: 499741233

E-mail: 499741233@qq.com

第1章 安裝環境1.1 系統內容

[root@10 conf]# uname -r

2.6.32-642.4.2.el6.x86_64

[root@10 conf]# uname -m

x86_64

[root@10 conf]# cat /etc/re

readahead.conf    redhat-lsb/       redhat-release    request-key.conf  request-key.d/    resolv.conf

[root@10 conf]# cat /etc/redhat-release

CentOS release 6.8 (Final)

1.2 程式版本1.2.1 Haproxy

[root@10 haproxy]# ./sbin/haproxy -v

HA-Proxy version 1.5.11 2015/01/31

Copyright 2000-2015 Willy Tarreau <w@1wt.eu>

1.2.2 Haproxy程式

 

第2章 Haproxy安裝啟動2.1 Haproxy安裝
tar xf haproxy-1.5.11.tar.gzcd haproxy-1.5.11make TARGET=linux26 PREFIX=/usr/local/haproxymake install PREFIX=/usr/local/haproxy備忘:TARGET要指定的系統的核心版本。
2.2 Haproxy設定檔
cd /usr/local/haproxy/mkdir confcd confvim haproxy.cfg[root@10 conf]# cat haproxy.cfgglobal    log         127.0.0.1 local0    log         127.0.0.1 local1 notice     chroot      /var/lib/haproxy    pidfile     /var/run/haproxy.pid    maxconn     4000    user        haproxy    group       haproxy    daemon     # turn on stats unix socket    stats socket /var/lib/haproxy/stats defaults    mode                    http    log                     global    option                  httplog    option                  dontlognull    option http-server-close    option                  redispatch    retries                 3    timeout http-request    10s    timeout queue           1m    timeout connect         10s    timeout client          1m    timeout server          1m    timeout http-keep-alive 10s    timeout check           10s    maxconn                 3000 frontend main    mode tcp    bind *:80    log global    option tcplog    log-format %ft\ %b/%s     tcp-request inspect-delay 3s    acl is_https req.payload(0,3) -m bin 160301#GET POS(T) PUT DEL(ETE) OPT(IONS) HEA(D) CON(NECT) TRA(CE)    acl is_http req.payload(0,3) -m bin 474554 504f53 505554 44454c 4f5054 484541 434f4e 545241#SSH    acl is_ssh req.payload(0,3) -m bin 535348    tcp-request content accept if is_http    tcp-request content accept if is_https    tcp-request content accept if is_ssh    tcp-request content accept    use_backend https if is_https    use_backend http if is_http    use_backend ssh if is_ssh    use_backend ssh backend ssh    mode tcp    timeout server 1h    server server-ssh 127.0.0.1:22 backend http    mode tcp    server ngx01 127.0.0.1:82 maxconn 10 check inter 3s backend https    mode tcp    server ngx02 127.0.0.1:433 maxconn 10 check inter 3s
2.3 啟動Haproxy
useradd -s /sbin/nologin -M haproxymkdir /var/lib/haproxy/usr/local/haproxy/sbin/haproxy -f /usr/local/haproxy/conf/haproxy.cfg
第3章 測試3.1 測試ssh服務
{17:05}~/login ➭ ssh root@10.63.101.52 -p80Last login: Thu Oct 13 17:05:27 2016 from localhost
3.2 測試http服務

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.