Apache reverse proxy and load balancing configuration

1. The principle of reverse proxy

Reverse proxy is a function often used by web servers. In reverse proxy mode, httpd server does not generate output data itself, but obtains data from back-end servers. These back-end servers are generally on the internal network and will not Communicate with the external network, but can communicate with the server where apache is located.

When the httpd server receives a request from the client, the request will be proxied to any server in the backend server group, the backend server receives the request and processes the request, then generates content and returns the content to the httpd server, and finally the httpd server Return content to the client.

2. Reverse proxy command

To use the reverse proxy function, you first need to dynamically enable the proxy module of apache, find the configuration file httpd.conf of apache, and add the following modules to the configuration file:

LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_http_module modules/mod_proxy_http.so
LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
LoadModule slotmem_shm_module modules/mod_slotmem_shm.so

You may also need to enable the following modules, which will be used later.

LoadModule lbmethod_byrequests_module modules/mod_lbmethod_byrequests.so
LoadModule lbmethod_bytraffic_module modules/mod_lbmethod

Guess you like

Origin blog.csdn.net/qq_35029061/article/details/132179607