Home | 简体中文 | 繁体中文 | 杂文 | 打赏(Donations) | OSChina 博客 | Facebook | Linkedin | 知乎专栏 | Search | About

第 40 章 Proxy Server

目录

40.1. Apache Proxy
40.2. Squid - Internet Object Cache (WWW proxy cache)
40.2.1. 源码安装
40.2.2. debian/ubuntu 安装
40.2.3. 配置
40.2.3.1. 正向代理
40.2.3.2. 代理服务器
40.2.3.3. Squid作为反向代理Cache服务器(Reverse Proxy)
40.2.3.4. 代理+反向代理
40.2.4. Squid 管理
40.2.4.1. squidclient
40.2.4.2. reset cache
40.2.5. 禁止页面被Cache
40.2.6. Squid 实用案例
40.2.6.1. Squid Apache/Lighttpd 在同一台服务器上
40.2.6.2. 用非 root 用户守护 Squid
40.2.7. squid+icap+clamav
40.3. Web page proxy
40.3.1. Surrogafier
40.3.2. CGIproxy
40.3.3. PHPProxy
40.3.4. BBlocked
40.3.5. Glype
40.3.6. Zelune
40.4. SOCKS
40.4.1. Socks5
40.4.2. dante-server - SOCKS (v4 and v5) proxy daemon(danted)
40.4.3. SSH Socks5 Tunnel
40.4.4. hpsockd - HP SOCKS server

40.1. Apache Proxy

netkiller@Linux-server:/etc/apache2$ sudo a2enmod proxy
Module proxy installed; run /etc/init.d/apache2 force-reload to enable.
netkiller@Linux-server:/etc/apache2$ sudo a2enmod proxy_connect
Module proxy_connect installed; run /etc/init.d/apache2 force-reload to enable.
netkiller@Linux-server:/etc/apache2$ sudo a2enmod proxy_http
Module proxy_http installed; run /etc/init.d/apache2 force-reload to enable.
netkiller@Linux-server:/etc/apache2$
		

proxy.conf

ProxyRequests On

ProxyPass /mirror/1/ http://netkiller.hikz.com/

ProxyPassReverse /mirror/1/ http://netkiller.hikz.com/

		
netkiller@Linux-server:/etc/apache2$ cat mods-available/proxy.conf
<IfModule mod_proxy.c>

        #turning ProxyRequests on and allowing proxying from all may allow
        #spammers to use your proxy to send email.

        #ProxyRequests Off
        ProxyRequests On

        <Proxy *>
                Order deny,allow
                Deny from all
                #Allow from .your_domain.com
                Allow from all
        </Proxy>

        # Enable/disable the handling of HTTP/1.1 "Via:" headers.
        # ("Full" adds the server version; "Block" removes all outgoing Via: headers)
        # Set to one of: Off | On | Full | Block

        ProxyVia On

        # To enable the cache as well, edit and uncomment the following lines:
        # (no cacheing without CacheRoot)

        CacheRoot "/var/cache/apache2/proxy"
        CacheSize 5
        CacheGcInterval 4
        CacheMaxExpire 24
        CacheLastModifiedFactor 0.1
        CacheDefaultExpire 1
        # Again, you probably should change this.
        #NoCache a_domain.com another_domain.edu joes.garage_sale.com

</IfModule>
		
		

VirtualHost

		
<VirtualHost *>
    ServerAdmin openunix@163.com
    DocumentRoot /home/netkiller/public_html
    ServerName netkiller.8800.org
    ErrorLog /home/netkiller/log/netkiller.8800.org-error_log
    CustomLog /home/netkiller/log/netkiller.8800.org-access_log common
    ProxyPass   /mirror/1/ http://netkiller.hikz.com/
    ProxyPassReverse    /mirror/1/ http://netkiller.hikz.com/

    <Location /repos>
      DAV svn
      SVNPath /home/netkiller/repos

    </Location>
</VirtualHost>
<VirtualHost *:*>
    ServerAdmin openunix@163.com
    ServerName mirror.netkiller.8800.org
    ErrorLog /home/netkiller/log/netkiller.8800.org-error_log
    CustomLog /home/netkiller/log/netkiller.8800.org-access_log common
    ProxyPass   / http://netkiller.hikz.com/
    ProxyPassReverse    / http://netkiller.hikz.com/
</VirtualHost>
		
		

测试http://netkiller.8800.org/mirror/1/, mirror.netkiller.8800.org