内部邀請碼:C8E245J (不寫邀請碼,沒有現金送)
國内私募機構九鼎控股打造,九鼎投資是在全國股份轉讓系統挂牌的公衆公司,股票代碼為430719,為“中國PE第一股”,市值超1000億元。
------------------------------------------------------------------------------------------------------------------------------------------------------------------
作業系統:CentOS 5.5
1)首先檢查伺服器是否安裝了squid:
which squid
2)yum安裝squid:
yum install squid
3)修改squid.conf參數:
vi /etc/squid/squid.conf
加入如下參數:
dns_nameservers 8.8.8.8
http_port 8000
# 允許所有人使用
http_access allow all
cache_mem 60 MB
visible_hostname redicecn.com
注意:一定要先注釋掉預設的http_access deny all(或者将其加到最後),因為squid配置邏輯是自上而下,滿足條件即不再和下面比對。
4)建立squid交換目錄:
cd /usr/sbin/
./squid -z
5)啟動squid、檢視端口狀态:
./squid
netstat -ntl
6)測試:
在浏覽器中設定代理:IP(squid主機的IP),端口(8000,http_port參數)
PS:如何停止squid?
./squid -k shutdown
續1)隐蔽代理(不增加代理頭,目标主機檢測不到代理的存在)
加入如下參數,即可:
forwarded_for off
header_access Via deny all
header_access X-Forwarded-For deny all
續2)加入基本認證
注意:要先注釋掉預設的http_access allow all,因為squid配置邏輯是自上而下,滿足條件即不再和下面比對。
在http_access deny all之前加入:
auth_param basic program /usr/lib/squid/ncsa_auth /usr/lib/squid/passwd
acl auth_user proxy_auth REQUIRED
http_access allow auth_user
接着生成密碼檔案: htpasswd -c /usr/lib/squid/passwd 使用者名
回車後會提示輸入兩次密碼。htpasswd需要先安裝Apache。