Build a simple HTTP reverse proxy and Haproxy

Source: Internet
Author: User
Tags haproxy rsyslog

Environment preparation


Web1 192.168.0.153

WEB2 192.168.0.126

Haproxy 192.168.0.154


We use the Yum source to install the Haproxy software here.


Yum Install Haproxy-y


    1. Configuring log levels for Haproxy

      Modify rsyslog log (vi /etc/sysconfig/rsyslog)

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/5B/3A/wKioL1UCrvHRrbzLAAFo2DYeq-Q515.jpg "title=" 70$ 4vni[755q]kem5i ' {a_n.png ' alt= "wkiol1ucrvhrrbzlaafo2dyeq-q515.jpg"/>
Modify the log level in the configuration file with the above modification (vi/etc/rsyslog.conf)

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/5B/40/wKiom1UCrzLArSlCAAIXreuC3W8534.jpg "title=" qi[ V6ZYOZMQASZ6W3@SVALL.png "alt=" Wkiom1ucrzlarslcaaixreuc3w8534.jpg "/> Start the log server Rsyslog

Service Rsyslog Restart

2. Modify the Haproxy Master profile and configure the corresponding host's link address (vi/etc/haproxy/haproxy.cfg)

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/5B/40/wKiom1UCslWA31msAAOOVK4Psqw978.jpg "title="%4r49s E NQY$YX]T1) U6) 5.png "alt=" Wkiom1ucslwa31msaaoovk4psqw978.jpg "/>

Restart Service Haproxy Restart


3. Check the port of Haproxy

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/5B/3A/wKioL1UCtBbT-L9HAAVbGo5N0FI695.jpg "title=" Hqns0rqn6nl00ikc[c8zy@h.png "alt=" Wkiol1uctbbt-l9haavbgo5n0fi695.jpg "/>

3. Configure the home page of Web1 and WEB2

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/5B/3B/wKioL1UCuoLRJv47AACc4CE8RW0102.jpg "style=" float: none; "Title=" hgw%6jmw@[) @MRBUG5 (Y) 1r.png "alt=" Wkiol1ucuolrjv47aacc4ce8rw0102.jpg "/>

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/5B/40/wKiom1UCuWCyjlzYAACjXyfO6aY303.jpg "style=" float: none; "Title=" rx[(m6c4$25ah ' L4 (01afag.png "alt=" Wkiom1ucuwcyjlzyaacjxyfo6ay303.jpg "/>



4. Test access

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/5B/40/wKiom1UCuxLAk5HwAACYTVHAV4s582.jpg "style=" float: none; "title=" 3$]0n ' ce4}hv2%8p ([637uj.png "alt=" Wkiom1ucuxlak5hwaacytvhav4s582.jpg "/>

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/5B/3B/wKioL1UCvDTw77A9AACCLIQTkX4225.jpg "style=" float: none; "title=" YXV6 ' 21ydfma3$ $U 73{x9jq.png "alt=" Wkiol1ucvdtw77a9aaccliqtkx4225.jpg "/>


5. Display the operating status of the Haproxy

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/5B/40/wKiom1UCu7DykuKPAAhJbvA_zRg727.jpg "title=" Z5dur4 ) 1r~y3u) x1q0 ' r$ba.png "alt=" Wkiom1ucu7dykukpaahjbva_zrg727.jpg "/>


The above is the simplest configuration haproxy content



The following will add keepalived+haproxy schema content, please pay attention!!! A lot of advice!!

Build a simple HTTP reverse proxy and Haproxy

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.