CentOS 6 Proxy server無法架起,麻煩幫忙 - Linux

Table of Contents

還是另開一篇回覆好了

本機 debug 的話 我意思是你在 telnet 到 squid 以後裡面打字送 GET

rellik@mercury(09:23:54)[~]$ telnet localhost 3128
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
GET http://www.google.com/

正常的話應該會有東西出來,底下是我機器上的資訊

HTTP/1.0 302 Moved Temporarily
Location: http://www.google.com.tw/
Cache-Control: private
Content-Type: text/html; charset=UTF-8
Set-Cookie: PREF=ID=da45352ce2b0833d:FF=0:TM=1352813059:LM=1352813059:S=sKV1DIn9a9aq4ZAO; expires=Thu, 13-Nov-2014
13:24:19 GMT; path=/; domain=.google.com
Set-Cookie: NID=65=d9wAgrpxHUUy9AGynifJo2buKTvpCSHEcHmdyzOHXBKPaO6G_YjE-FCofe15k79GjONCCdOt3szSXrBtQO-sVHeTbRbNMCF
vwuEOtlJ_xaDn9jR8AVxli6YToy6aqqo_; expires=Wed, 15-May-2013 13:24:19 GMT; path=/; domain=.google.com; HttpOnly
P3P: CP="This is not a P3P policy! See http://www.google.com/support/accounts/bin/answer.py?hl=en&answer=151657 fo
r more info."
Date: Tue, 13 Nov 2012 13:24:19 GMT
Server: gws
Content-Length: 222
X-XSS-Protection: 1; mode=block
X-Frame-Options: SAMEORIGIN
X-Cache: MISS from localhost
X-Cache-Lookup: MISS from localhost:3128
Proxy-Connection: close

<HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">
<TITLE>302 Moved</TITLE></HEAD><BODY>
<H1>302 Moved</H1>
The document has moved
<A HREF="http://www.google.com.tw/">here</A>.
</BODY></HTML>
Connection closed by foreign host.


本機 ok 的話請檢查一下 squid.conf acl 設定是不是還需要開啟哪裡

我本機的 squid.conf 在這裡可以參考修改 .. http://fpaste.org/RWOj/
你要拿過去用的話要把你的 lan 端加入 http_access 裡面


※ 引述《yonkX (yonkX)》之銘言:
: Linux 系統是Centos 6.0
: 很久很久以前有架過Proxy,記憶中不需要加入太多設定就能使用.但最近架設完後發現不
: work.爬文爬了二天,找不到錯誤,麻煩大家幫忙.
: 環境:
: 1. 用VM架起.
: 2. 網路類型設定bridge
: 3. IP是用DHCP取得,其它無特別設定什麼網路環境..
: 網路是10.17.15.19, netmask:255.255.255.0
: 目前squid.conf設定狀況:
: 1. 已經用YUM 安裝squid, 指令:yum install squid*
: 2. 加入acl test src 10.17.15.0/24 <==允許其它10.17.15.X IP能使用這個proxy
: 3. 加入http_access allow test <==允許test
: 4. 加入visible hostname www.test.com.tw <==網路爬文看到要加這段
: 5. 其餘設定不改變.
: 另外因為剛剛squid.config設定了第四個visible指令.
: 所以我在/etc/sysconfig/network加入下面設定
: 1. HOSTNAME=www.test.com.tw
: 測試方式.
: 1. 下service network restart跟service squid restart. 確認服務都有起來
: 2. 下netstat -tnl |grep :3128 確認http request port有起來.
: 3. 在實體PC上IE瀏覽器上設定Proxy為10.17.15.19 port設定80或3128都試過.
: (指令http_port 3128設成3128時,我IE就設3128)
: (指令http_port 80 設成80 時,我IE就設80 )
: 4. 在實體PC 或VM下的Centos 都能互相ping的到.
: 5. 開啟網頁.
: 想請問大家是那裡我還沒有設定到嗎?
: 目前我有試過清掉iptables跟把selinux關掉,結果依然無法使用.
: 指令:
: 1. iptables -F 和iptables save
: 2. vim /etc/sysconfig/selinux修改SELINUX=disable
: ~~~~~~~~~~~~~下面是剛剛又再測試出來的資訊,不知道提供了有沒有幫助~~~~~~~~~~~~~~
: 1. 下面有試過測試telent (感覺服務好像怪怪的?)
: [root@www Desktop]# telnet localhost 3128
: Trying 127.0.0.1...
: Connected to localhost.
: Escape character is '^]'. <===不知道為什麼卡在這裡.
: 2. 另外在下restart network ,有出現一些訊息. (不過感覺不影響)
: [root@www Desktop]# service network restart
: Shutting down loopback interface: [ OK ]
: Bringing up loopback interface: [ OK ]
: Bringing up interface eth0: Active connection state: activating
: Active connection path: /org/freedesktop/NetworkManager/ActiveConnection/2
: state: activated
: Connection activated
: → rellik:請問既然squid跑3128 port , 為何 IE 瀏覽器指定是 80 port 11/13 09:45
: 我看config有二行.
: acl Safe_ports port 80 <---這行用80,
: http_port 3128 <---我看這是listen port, 我曾經也有試著把這個設成80.
: 並且在browser上也是用80,但還是不行.
: 所以我當初在IE上才會也設80.不過預設的3128我有試過
: 也是不行.
: → rellik:1是正常的, GET http://www.google.com/ 看有沒網頁.. 11/13 09:46
: 我使用GET或get都沒有這個指令.先輸入ge在按Tab鍵也是沒有
: (我印像中以前架server時有)
: 想請問架設Proxy前是是還有要設定什麼.Proxy才能被架設起來?
: ※ 編輯: yonkX 來自: 118.233.64.60 (11/13 10:43)
: ※ 編輯: yonkX 來自: 118.233.64.60 (11/13 10:46)

--

All Comments

Andy avatarAndy2012-11-15
忘了說..我的 cache_dir 和 user,group 可能會和預設不一樣
Isabella avatarIsabella2012-11-17
大大我看了我們二個conf,感覺好像主要的都差不多.
Dora avatarDora2012-11-17
另外我用get http://www.google.com.tw/服務Unavailable
不太知道要怎麼處理.(我之前架設時是也有架設httpd等服務
Skylar Davis avatarSkylar Davis2012-11-19
這樣有差嗎?我附一下我的config跟get 出來的資訊.
http://sendbee.com/file/v95ed0qa <==squid config
http://sendbee.com/file/kwx3wgix <==get google 結果
Leila avatarLeila2012-11-20
另外我把網段改成192.168.1.X/24其餘不變.大大能指導一下嗎?
Una avatarUna2012-11-20
看了一下設定檔,其實你把 error log 位置開起來,應該就看到
Ursula avatarUrsula2012-11-25
一些錯誤訊息了, 再到裡面去看怎麼 debug
Daph Bay avatarDaph Bay2012-11-28
大大,請問是要看access.log還是cache.log還是squid.out
Oscar avatarOscar2012-12-02
我是被學,對於debug能力還在慢慢陪養.在麻煩大大指教一下
Carol avatarCarol2012-12-05
我三個都有看了.看到錯誤,也不知道要怎麼DEBUG
Tracy avatarTracy2012-12-08
請問PROXY還有要設定什麼嗎?
Kristin avatarKristin2012-12-09
錯誤訊息是什麼? squid 安裝完就能動了,不需要額外安裝東西
Brianna avatarBrianna2012-12-12
我今天下課後馬上回家在把log輸出一次.在請大大幫忙.謝謝.
Eden avatarEden2012-12-15
大大我把Log輸出了.我附在下面.
http://sendbee.com/file/z9nbdf44 (squid_cache)
http://sendbee.com/file/z9nbdf44&del=899227 squid_access
Emma avatarEmma2012-12-16
Bennie avatarBennie2012-12-17
前兩個連結沒辦法看到,第三個出了 No running copy
Kelly avatarKelly2012-12-20
請檢查一下squid 有沒有跑起來,另外 squid pid和它pid檔案
內容是不是相同的
Elvira avatarElvira2012-12-24
只要看到有什麼 error 訊息可以貼到 google 上應該都有答案
Candice avatarCandice2012-12-29
對了..acl部分http_access allow 都放到 deny 的上面才行..
他一比對下來已經先 deny 就直接丟掉了..
Edwina avatarEdwina2013-01-01
感謝大大提供方法.我已經找到問題了.不過方便請問,我的LOCAL
PC 現在是能透過Proxy server出去,但是開網頁速度"很慢"
Tristan Cohan avatarTristan Cohan2013-01-06
請問有地方能調效嗎?可以給我些實務上的建議或教學嗎?
Daph Bay avatarDaph Bay2013-01-06
其實架設在vm裡面 ..會慢很正常呀
Poppy avatarPoppy2013-01-10
我常常都慢到time out這樣是正常的嗎? 我記得我之前是二個
Daph Bay avatarDaph Bay2013-01-14
VM LINUX 互相做測試.好像不會這麼慢( 不過HTTP是跟SQUID
架在同一台,測試也只有連到HTTP這台WEB SERVER)
Skylar Davis avatarSkylar Davis2013-01-18
不過我還是換架在實體PC試試看好了. 另外我其中一個環境不小
心下到iptables -F跟disable selinux就突然出不去.
Heather avatarHeather2013-01-19
(不確定是慢到time out,還是真的不行)
理論上下到iptables -F跟disable selinux會影響 client去連
Mason avatarMason2013-01-20
到proxy server嗎? (透過Proxy 瀏覽網頁)
Rae avatarRae2013-01-21
iptables 下了以後..因為清除了所有規則預設就是封包都丟..