Deploying Haproxy+nginx on CentOS7 to implement a Web cluster

Source: Internet
Author: User
Tags haproxy

Haproxy is a free and open code software written in C that provides high availability, load balancing, and TCP and HTTP-based application proxies that can run on most major Linux operating systems.
This experiment with three servers, one server installation haproxy implementation scheduling, another two servers to build Nginx to provide Web services, a client test access.

The server needs to change the network adapter to NAT mode and download the installation package online
Scheduling Server Installation Related packages

Web Server Installation Related packages

After installation, change the network adapter to host-only mode, modify the IP address
Haproxy Server: 192.168.100.21/24
Web Server 1:192.168.100.22/24
Web Server 2:192.168.100.23/24
Client: 192.168.100.30/24

1, Web Server installation Nginx
Mount the Nginx package to the virtual machine for decompression and go to the extracted folder for configuration


Create user Nginx does not use shell login

Create a test page

Open Nginx

Turn off firewall and security features

Self - rated

The second Web server is configured identically

2. Dispatch server
Attach the Haproxy package to the virtual machine and use it after decompression
Go to the extracted folder to compile


Create the/etc/haproxy directory and copy the configuration file to this directory

Edit the configuration file, delete all listen parts, add a new listen part of the content


Copy configuration files, add permissions, set up soft links, open services

Turn off firewall and security features

Client access test, the client input is: Dispatch server IP Address/test.html

Re-access after refresh

3. Log Management
Edit Haproxy configuration file


Restart Haproxy


The script that generated the log reads as follows

Restart Log service

Go to/var/log/directory, no Haproxy folder

Use client access before viewing the Haproxy folder

Go to the Haproxy folder to see the generated log files

View content to see access information

Deploying Haproxy+nginx on CentOS7 to implement a Web cluster

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.