Home | 簡體中文 | 繁體中文 | 雜文 | 知乎專欄 | Github | OSChina 博客 | 雲社區 | 雲棲社區 | Facebook | Linkedin | 視頻教程 | 打賞(Donations) | About
知乎專欄多維度架構 微信號 netkiller-ebook | QQ群:128659835 請註明“讀者”

第 39 章 Proxy Server

目錄

39.1. Apache Proxy
39.2. Squid - Internet Object Cache (WWW proxy cache)
39.2.1. 源碼安裝
39.2.2. debian/ubuntu 安裝
39.2.3. 配置
39.2.3.1. 正向代理
39.2.3.2. 代理伺服器
39.2.3.3. Squid作為反向代理Cache伺服器(Reverse Proxy)
39.2.3.4. 代理+反向代理
39.2.4. Squid 管理
39.2.4.1. squidclient
39.2.4.2. reset cache
39.2.5. 禁止頁面被Cache
39.2.6. Squid 實用案例
39.2.6.1. Squid Apache/Lighttpd 在同一台伺服器上
39.2.6.2. 用非 root 用戶守護 Squid
39.2.7. squid+icap+clamav
39.3. Web page proxy
39.3.1. Surrogafier
39.3.2. CGIproxy
39.3.3. PHPProxy
39.3.4. BBlocked
39.3.5. Glype
39.3.6. Zelune
39.4. Socks/Socks5
39.4.1. Socks5
39.4.2. dante-server - SOCKS (v4 and v5) proxy daemon(danted)
39.4.3. SSH Socks5 Tunnel
39.4.4. hpsockd - HP SOCKS server
39.4.5. Shadowsocks - A secure socks5 proxy, designed to protect your Internet traffic.
39.4.5.1. Server
39.4.5.1.1. Python PyPI
39.4.5.1.2. GitHub
39.4.5.2. ssserver 命令
39.4.5.3. Client
39.4.5.3.1. Shadowsocks for Windows

39.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