apache reverse forwarding

        Apache reverse proxy is mainly used for load balancing. The BalancerMember parameter loadfactor can set the corresponding weight; now the function to be implemented is that one application server and one port are forwarded to different addresses according to the URL, and reverse proxy is also used:

Current development environment: xampp7.3.6

1) Apache opens module support:

LoadModule proxy_module modules/mod_proxy.so

LoadModule proxy_ajp_module modules / mod_proxy_ajp.so

LoadModule proxy_balancer_module modules/mod_proxy_balancer.so

LoadModule proxy_connect_module modules/mod_proxy_connect.so

LoadModule proxy_express_module modules/mod_proxy_express.so

LoadModule proxy_fcgi_module modules/mod_proxy_fcgi.so

LoadModule proxy_ftp_module modules/mod_proxy_ftp.so

LoadModule proxy_hcheck_module modules/mod_proxy_hcheck.so

LoadModule proxy_html_module modules/mod_proxy_html.so

LoadModule proxy_http_module modules/mod_proxy_http.so

LoadModule socache_shmcb_module modules / mod_socache_shmcb.so

LoadModule watchdog_module modules/mod_watchdog.so

LoadModule xml2enc_module modules/mod_xml2enc.so

2) vhost configuration: 8080 accepts user requests, and then forwards to 8081 or other ip:port according to the route

<VirtualHost *:8081>

    DocumentRoot "Processing path address of php application"

    ErrorLog "logs/error.log"

    CustomLog "logs/access.log" common

</VirtualHost>

<VirtualHost *:8080>

ProxyRequests Off

<Proxy *>

Order deny,allow

Allow from all

</Proxy>

ProxyPass /api/route path/ http://other ip:port/api/

ProxyPa***everse /api/route path/ http://other ip:port/api/

ProxyPass /api/ http://127.0.0.1:8081/api/

ProxyPa *** everse / api / http://127.0.0.1:8081/api/

</VirtualHost>


Guess you like

Origin blog.51cto.com/hjun169/2546130