How to use Haproxy for port forwarding

First install HAProxy

Centos

Yum install haproxy -y

 

Debian use

Vi /etc/apt/sources.list

Add the following content

Deb http://ftp.us.debian.org/debian/ wheezy-backports main

then

Apt-get update apt-get install haproxy

Next set the configuration file

Vi /etc/haproxy/haproxy.cfg

 

After clearing the configuration file, enter the following content

Global
        Ulimit-n 51200

Defaults
        Log global
        Mode tcp
        Option dontlognull
        Timeout connect 1000
        Timeout client 150000
        Timeout server 150000

Frontend ss-in
        Bind *:8388
        Default_backend ss-out

Backend ss-out
        Server server1 VPS_IP:8388 maxconn 20480

If you need multiple server polling, you can build more server polls in the backend.

 

Run Haproxy

Haproxy -f /etc/haproxy/haproxy.cfg
  • 210 Users Found This Useful
Was this answer helpful?

Related Articles

How to choose the cloud server?

★ Choose the right cloud server configuration based on your actual business needs: Understand...

How do I connect to my cloud server? (including linux and windows)

First of all to distinguish between linux and windows, including ubuntu, centos, debian are...

linux system data disk merged into the system disk

 Check it out, the current command: df -h [[email protected] ~]# df -h Filesystem...

Linux cloud server data disk expansion tutorial guide

This tutorial belongs to the data disk expansion [non-system disk] default directory /dev/sdb...

About the automatic synchronization of cloud server time, and the problem that time cannot be modified.

Recently, there have been user feedback, cloud server time cannot be modified. The solution is...