Apache reverse proxy settings in Ubuntu

Source: Internet
Author: User
Apache can use the mod_proxy *. So series modules to implement the forward and reverse proxy functions, or use reverse proxy to achieve load balancing. This article describes how to configure Load Balancing Based on Apache reverse proxy.

 

1. Environment configuration instructions:

Proxy Server Domain Name: AP. Proxy

Web Server 1 IP: 192.168.195.18 port: 80

Web Server 2 IP: 192.168.195.19 port: 80

Backup Server IP: 192.168.195.20 port: 80

 

2. Confirm the opening module: mod_proxy, mod_proxy_balancer, mod_proxy_http

Loadmodule proxy_module modules/mod_proxy.so
Loadmodule proxy_balancer_module modules/mod_proxy_balancer.so
Loadmodule proxy_http_module modules/mod_proxy_http.so

 

3. Simple reverse proxy settings:
<Virtualhost *: 80>
Serveradmin [email protected]
Servername AP. Proxy
Proxyrequests off
Proxymaxforwards 100
Proxypreservehost on
Proxypass/http: // 192.168.195.18/
Proxypassreverse/http: // 192.168.195.18/

<Proxy *>
Order deny, allow
Allow from all
</Proxy>
</Virtualhost>

 

4. reverse proxy for load balancing:
<Virtualhost *: 80>
Serveradmin [email protected]
Servername AP. Proxy
Proxyrequests off # enable reverse proxy
Proxypass/balancer: // proxy/
<Proxy balancer: // proxy>
Order deny, allow
Allow from all
Balancermember http: // 192.168.195.18 loadfactor = 3 # Web Server 1, loadfactor -- load ratio allocation
Balancermember http: // 192.168.195.19 loadfactor = 1 # Web Server 2, loadfactor -- load ratio allocation
Balancermember http: // 192.168.195.20 status = + H # Backup Server

# Load Distribution Algorithm
# Lbmethod = byrequests balanced by the number of requests (default)
# Lbmethod = bytraffic traffic balancing
# Lbmethod = bybusyness balanced by the degree of busy (always allocated to the server with the least number of active requests)
Proxyset lbmethod = bytraffic
</Proxy>
</Virtualhost>

For more settings, see the Apache manual ......

Apache reverse proxy settings in Ubuntu

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.