精華區beta FreeBSD 關於我們 聯絡資訊
[HOWTO] proxy Index/Distfile/PortSnap Server ====== 授權方式 ====== 姓名標示-非商業性-相同方式分享 2.5 (Attribution-NonCommercial-ShareAlike 2.5) http://creativecommons.org/licenses/by-nc-sa/2.5/ ====== 前言 ====== 首先要感謝 cdsheen 大長輩,如果沒他,就沒有這篇的出現了 基本上例子中的設定都抄自他那邊 :D 本文適用環境:當你所管的機器或所屬單位的機器,位於 Private Network 內, 無法 access Public Network 的話,且上層/安全 policy 也不予許, 加上沒有多餘硬體成本來做 mirror, 這時候 mod_proxy 應該會是比較好的選擇方案。 建議硬體: 假設例子中要架的那台有兩張網卡,一張對外,一張對內: 192.168.xxx.yyy (不過實際上,我們這邊弄的又是另一種方案.. 相信聰明的人可以觸類旁通, 大致是混合上述方案, ~_~" 工作上的東西不便透露太詳細,得再重新整理才行, 這已經是精簡版了) ====== indexfile/Distfile/PortSnap Server ====== ■ 建立 indexfile/Distfile/PortSnap Server 的 Proxy ● 首先先弄 Server 端: 因為有用到 Apache Server 的 mod_proxy,所以要修改 httpd.conf 加上下面這段 <IfModule mod_proxy.c> # 只做 proxy 而不 cache ProxyRequests Off <Directory proxy:*> Order deny,allow Deny from all Allow from 192.168. </Directory> # ProxyVia On # # 這段是處理 indexfile (就是你在 /usr/ports 打 make fetchindex 會用到的) # 設定下游若有請求 http://192.168.xxx.yyy/ports 則一律自動 reverse proxy # 都轉向上游 http://freebsd.giga.net.tw/ports 要 # ProxyPass /ports http://freebsd.giga.net.tw/ports ProxyPassReverse /ports http://freebsd.giga.net.tw/ports # # 這段是處理 distfiles (所謂的 tar ball 檔) # 設定下游若有請求 http://192.168.xxx.yyy/distfile 則一律自動 reverse proxy # 都轉向上游 http://ftp.giga.net.tw/distfiles 要 # ProxyPass /distfiles http://ftp.giga.net.tw/distfiles ProxyPassReverse /distfiles http://ftp.giga.net.tw/distfiles # # 這段是處理 portsnap # 設定下游若有請求 http://192.168.xxx.yyy/portsnap 則一律自動 reverse proxy # 都轉向上游 http://portsnap.webamp.cc 要資料 # ProxyPass /portsnap http://portsnap.webamp.cc ProxyPassReverse /portsnap http://portsnap.webamp.cc </IfModule> 接著改完後, apachectl graceful 重跑 apache 即可 ● 接下來是 client 端的設定 ◆ 修改 /etc/make.conf MASTER_SITE_INDEX?= http://192.168.xxx.yyy/ports/ MASTER_SITE_BACKUP?= http://192.168.xxx.yyy/distfiles/${DIST_SUBDIR}/ MASTER_SITE_OVERRIDE?= ${MASTER_SITE_BACKUP} ◆ 如果要跑 portsnap 的話,修改 /usr/local/etc/portsnap.conf 把原本的 URL=http://portsnap.daemonology.net 註解起來,改為 #URL=http://portsnap.daemonology.net URL=http://192.168.xxx.yyy/portsnap -- 靜中見真境,淡中識本然 -- ◢◣ - ● - ◢██◣◢◣ ` Origin: 宜蘭資教.山水蘭陽 telnet://yilan.twbbs.org ~~ ﹌ ~﹌ From : 220-135-110-151.HINET-IP.hinet.net