Apache reverse proxy and load balancer

Source: Internet
Author: User

Forward Proxy: As we use the Game Accelerator agent, most of the personal PC sends the request to the forward proxy server, the proxy server usually configures the high-end bandwidth, requests the corresponding service for US

reverse proxy in load balancing: In a general sense, it is a proxy that requests forwarding. Like a mailroom manager, a lot of incoming mail is sent to the mailroom, which is then assigned to different offices by the administrator. This allows each server to avoid excessive load and lead to downtime. This process, which is forwarded, usually has a number of different algorithms.

Summary: A forward proxy generally refers to a PC connected to a proxy server, forwarded by a proxy server to a Web site. The reverse proxy refers to the user sending the request to the reverse proxy server, which forwards the request route to the specific server by the reverse proxy server.

One might consider that if a request is logged on while the second request is in action, the second request is forwarded to the second server. Then how to operate. This is not to worry, Apache reverse Proxy has a concept of session adhesion, it will be all the files about the cookie on the Apache server, the other operations will read such a file.

Apache Reverse Proxy Setup method

Open the Conf folder for the Apache installation directory (Linux in/etc/httpd/conf or/usr/local/apache/conf)

Open httpd.conf

Put

LoadModule Proxy_module modules/mod_proxy.so
LoadModule Proxy_http_module modules/mod_proxy_http.so

Remove the previous comment

At the end of httpd.conf, add

Namevirtualhost *:80

<virtualhost *:80>
ServerName www.linuxidc.com
Serveralias www.linuxidc.com
Proxyrequests OFF
<proxy http://www.linuxidc.com>
Options MultiViews
AllowOverride None
Order Allow,deny
Allow from all
</Proxy>
proxypass/http://61.191.191.4:9002/
proxypassreverse/http://61.191.191.4:9002/
</VirtualHost>

<virtualhost *:80>
ServerName img.linuxidc.com
Serveralias img.linuxidc.com
Proxyrequests OFF
<proxy http://img.linuxidc.com>
Options MultiViews
AllowOverride None
Order Allow,deny
Allow from all
</Proxy>
proxypass/http://61.191.191.4:9003/
proxypassreverse/http://61.191.191.4:9003/
</VirtualHost>

Implementation of Apache load Balancing

1, see if there are mod_proxy_http.so, mod_proxy_balancer.so, mod_proxy.so three modules

# Ll/usr/local/apache2/modules

2. Loading module

# cd/usr/local/src/httpd-2.2.23/modules/proxy/

#/usr/local/apache2/bin/apxs-c-I mod_proxy.c proxy_util.c

#/usr/local/apache2/bin/apxs-c-I mod_proxy_balancer.c

#/usr/local/apache2/bin/apxs-c-I Mod_proxy_http.c

3. Modify the http.conf configuration file

# vim/usr/local/apache2/conf/httpd.conf

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

Proxyrequests OFF

<proxy balancer://clusterphpinfo>

Balancermember http://10.0.2.203:80 loadfactor=1

Balancermember http://10.0.2.204:80 loadfactor=1

</Proxy>

Proxypass/balancer://clusterphpinfo

4. Restart HTTPD Service

# Service httpd Restart

5, through Apache to the back-end server to make master and slave, only need to add status=+h from behind the server

# vim/usr/local/apache2/conf/httpd.conf

Balancermember http://10.0.2.204:80 loadfactor=1 status=+h

Apache reverse proxy and load balancing

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.