Home | Mirror | Search

第 44 章 Proxy Server

目錄

1. Apache Proxy
2. Squid - Internet Object Cache (WWW proxy cache)
2.1. 源碼安裝
2.2. debian/ubuntu 安裝
2.3. 配置
2.3.1. 正向代理
2.3.2. 代理伺服器
2.3.3. Squid作為反向代理Cache伺服器(Reverse Proxy)
2.3.4. 代理+反向代理
2.4. Squid 管理
2.4.1. squidclient
2.4.2. reset cache
2.5. 禁止頁面被Cache
2.6. Squid 實用案例
2.6.1. Squid Apache/Lighttpd 在同一台伺服器上
2.6.2. 用非 root 用戶守護 Squid
2.7. squid+icap+clamav
3. Web page proxy
3.1. Surrogafier
3.2. CGIproxy
3.3. PHPProxy
3.4. BBlocked
3.5. Glype
3.6. Zelune
4. SOCKS
4.1. Socks5
4.2. dante-server - SOCKS (v4 and v5) proxy daemon(danted)
4.3. SSH Socks5 Tunnel
4.4. hpsockd - HP SOCKS server

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

comments powered by Disqus