且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

apache 正向代理反向代理

更新时间:2022-10-11 22:48:41

<VirtualHost *:80>
    ServerAdmin 523775@qq.com
    DocumentRoot "/var/www/html/"
    ServerName www.test.com
    ServerAlias test.com
    ErrorLog "logs/test.com-error.log"
    CustomLog "logs/test.com-access.log" common    
    Alias /html "/var/www/html/"

    <Directory "/var/www/html/">
        Options FollowSymLinks
        AllowOverride All
        Order allow,deny
        Allow from all
    </Directory>
    
    #正向代理设置,internet选项---连接---局域网设置---代理服务器--填写www.test.com
    ProxyRequests On
    ProxyVia On

    <Proxy *>
        Order deny,allow
        Deny from all
        Allow from 10.0.0.1/8
    </Proxy>
</VirtualHost>

<VirtualHost *:80>
   ServerAdmin 523775@qq.com
   DocumentRoot "/var/www/html/"
   ServerName www.abc.com
   ServerAlias abc.com
   ErrorLog "logs/abc.com-error.log"
   CustomLog "logs/abc.com-access.log" common    
   Alias /html "/var/www/html/"
   <Directory "/var/www/html/">
        Options FollowSymLinks
        AllowOverride All
        Order allow,deny
        Allow from all
    </Directory>
    
    #反向代理设置
    ProxyPass / http://www.test.com/
    ProxyPassReverse / http://www.test.com/

</VirtualHost>




本文转自 freeterman 51CTO博客,原文链接:http://blog.51cto.com/myunix/1736228,如需转载请自行联系原作者