如何用Squid Windows版架設二級Proxy 伺服器

來源:互聯網
上載者:User

一、Windows版Squid的下載與安裝

下載windwosNT版本的squid:

http://squid.acmeconsulting.it/download/squid-2.6.STABLE13-bin.zip

1.把squid-2.6.STABLE13-bin.zip解壓縮,把裡面的squid檔案夾拷到c:/下(squid預設的是c:/squid)

2.squid/etc目錄下把

squid.conf.default拷貝一份重新命名為squid.conf

cachemgr.conf.default拷貝一份重新命名為cachemgr.conf

mime.conf.default拷貝一份重新命名為mime.conf

3.用文字編輯器開啟squid.conf,需要修改的地方:

找到http_port 3128在後面增加一行

http_port 80 transparent

找到#cache_peer sib2.foo.net sibling 3128 3130 [proxy-only]在後面增加一行

cache_peer 192.168.1.8 parent 7001 0 no-query originserver

找到# TAG: visible_hostname在後面增加一行

visible_hostname volcano(任意命名)

找到http_access deny all在其前面加#將這一行注釋掉,然後增加一行

http_access allow all

4.從命令列到c:/squid/sbin目錄下執行

squid -i(將squid服務加入到服務裡面)

squid -z

安裝完成

5.從服務裡啟動squid

訪問squid伺服器:

http://192.168.1.2(你的squid伺服器IP地址)>>>指向http://192.168.1.8:7001(web伺服器位址)

如果把#http_access deny all開啟把http_access allow all注釋掉,你的訪問就會被拒絕

你需要配置一下:找到下面兩行

#acl our_networks src 192.168.1.0/24 192.168.2.0/24

#http_access allow our_networks

開啟注釋,修改你的內網ip(段)可以設為192.168.1.0/24一個也可以如上面的一樣設一段IP

二、squid.conf設定檔

cache_mgr ghxu@zju.edu.cn #設定管理員郵箱,無關緊要

visible_hostname ibi #設定虛擬機器主機名,似乎squid2.5這個版本需要

#設定這一項,2.4卻不需要

cache_peer 10.10.2.53 parent 6666 3130 login=account:passwd default no-query

#設定上級代理,其中10.10.2.53是我們校內的Proxy 位址,6666是他的連接埠號碼,

#account,passwd則是上網帳號密碼(當然我不會把我們真實的帳號貼出來)

#hierarchy_stoplist cgi-bin ? #注釋掉這一行,不然不能訪問帶有"?"

#的url

#acl QUERY urlpath_regex cgi-bin ? #這兩行沒有具體測試,應該和cgi請求有關

#no_cache deny QUERY

acl all src 0.0.0.0/0.0.0.0

acl manager proto cache_object

acl localhost src 127.0.0.1/255.255.255.255

acl SSL_ports port 443 563

acl Safe_ports port 80 # http

acl Safe_ports port 21 # ftp

acl Safe_ports port 443 563 # https, snews

acl Safe_ports port 70 # gopher

acl Safe_ports port 210 # wais

acl Safe_ports port 1025-65535 # unregistered ports

acl Safe_ports port 280 # http-mgmt

acl Safe_ports port 488 # gss-http

acl Safe_ports port 591 # filemaker

acl Safe_ports port 777 # multiling http

acl CONNECT method CONNECT

acl lan-a src 10.49.41.150-10.49.41.190/32 #對ip進行控制,這行定義了一個ip

#段為組lan-a

http_access allow lan-a #這裡控制組lan-a的ip可以使用squid代理

acl lan-b src 10.141.96.0/24 #同樣設定了一個ip段,ip地址前三位是

#10.141.96的所有ip,其實就是我們寢室樓的ip段

http_access allow lan-b

http_access allow manager localhost

http_access deny manager

http_access deny !Safe_ports

http_access deny CONNECT !SSL_ports

http_access allow localhost

http_access deny all

icp_access allow all

never_direct allow all #這一行解決無法登陸的問題.

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.