最近因應某些需求,除了可以用 VPN 來解決外,也思考用 squid Proxy Server 解決的可能方式。
1. 修改設定檔
# vim /etc/squid/squid.conf
在 acl 區段加入下面這二行
acl squid_user proxy_auth REQUIRED
auth_param basic program /usr/lib64/squid/ncsa_auth /etc/squid/passwd
2. 在 /etc/squid/squid.conf 中的 http_access deny all 前面加入下面這一行
http_access allow squid_user
[@more@]
3. 建立所須的密碼檔
這裡建立二個使用者 teacher01 和 student01
# /usr/bin/htpasswd -b -c /etc/squid/passwd teacher01 123456
Adding password for user teacher01
# /usr/bin/htpasswd -b /etc/squid/passwd student01 234567
Adding password for user student01
檢查帳號是否有設定成功
# more /etc/squid/passwd
teacher01:Z6gIorvSGN/UI
student01:jbqLqf5mmJQKE
4. 重新啟動 squid Proxy Server
# service squid restart
5. 開啟瀏覽器,做 Proxy Server 的設定,以 IE 為例
輸入 Proxy Server 的 IP 和使用的 Port,然後按 確定
如果 Firefox 要採用和 IE 一樣的設定