mod_proxy Settings#22016/06/15 |
Enable mod_proxy module to configure reverse proxy settings. This example is based on the environment below.
This example set servers that requests to (1)Web server forward to / on (2)webserver.
|
|||||||
[1] | mod_proxy is included in apache2 package by default, so it's possible to configure quickly. |
root@www:~# a2enmod proxy proxy_http
root@www:~#
vi /etc/apache2/mods-enabled/proxy.conf # add between <IfModule mod_proxy **> - </IfModule>
<IfModule mod_proxy.c>
ProxyRequests Off
<Proxy *>
Require all granted
</Proxy>
ProxyPass / http://node01.srv.world/
ProxyPassReverse / http://node01.srv.world/
root@www:~# systemctl restart apache2
|
Access to frontend server to make sure backend server responses like follows. |
[2] |
It's possible to configure load balancing settings.
|
root@www:~# a2enmod proxy proxy_http lbmethod_byrequests
root@www:~#
vi /etc/apache2/mods-enabled/proxy.conf # add between <IfModule mod_proxy **> - </IfModule>
<IfModule mod_proxy.c>
ProxyRequests Off
<Proxy *>
Require all granted
</Proxy>
# specify the way of load balancing with "lbmethod". it's also possible to set "bytraffic".
ProxyPass / balancer://cluster lbmethod=byrequests
<proxy balancer://cluster>
BalancerMember http://node01.srv.world/ loadfactor=1
BalancerMember http://node02.srv.world/ loadfactor=1
</proxy>
root@www:~# systemctl restart apache2
|
Access to frontend server to make sure backend servers responses like follows. |
Sponsored Link |