C
C
chelius_ua2017-07-04 17:23:18
HAproxy
chelius_ua, 2017-07-04 17:23:18

How to set up direct proxying to a web server in HaProxy?

Hello! I'll try to explain simply, don't hit me hard for stupid terminology) There is a web server on which several websites are deployed and Nginx is used as a web server. Sites do not hang on separate ports, but as virtual hosts. The server is now sitting on its white ip, in the NS records of our domain for the necessary subdomains it is written on which ip to look at. Now there is a task to remove it into the common infrastructure, that is, remove it from the white IP and configure HaProxy so that it would proxy requests to these sites already inside the common infrastructure. Does anyone have a simple example of how to write such a config, because I'm used to backend servers running something on a separate port, and I need it to drop to 10.0.1.15 when site1.example.com is requested and at the same time open the site that registered on nginx as site1.example.com
Would this configuration work? Thank you!
acl is_site1 hdr(host) -i site1.example.com
use_backend site1 if is_site1
backend site1
server web 10.0.1.15:80 check

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question