Squid Proxy Server 安裝設定

以下是在 CentOS 4.6 底下安裝與設定 Squid Proxy Server

1 安裝程序

su - root
yum install squid
[root@tryboxap01 ~]# rpm -q squid
squid-2.5.STABLE14-1.4E.el4_6.1

2 設定參數檔

  • 允許 ftp 的 Proxy 功能
  • 允許 https 使用 port 7443 的 SSL Proxy 功能
  • 允許 Google Talk 使用 port 5222 的 http Proxy 功能
  • 假設指定只有 來自 61.67.71.0/24 與 220.130.131.238 的 IP 範圍才可以使用
  • 允許接受 SVN 的延伸指令 REPORT MERGE MKACTIVITY CHECKOUT

vi /etc/squid/squid.conf

:
ftp_user wwwuser@ichiayi.com
:
acl SSL_ports port 443 7443
:
acl Safe_ports port 443        # https
acl Safe_ports port 7443    # https-g2b2c
acl Safe_ports port 5222    # GoogleTalk
:
acl our_networks src 61.67.71.0/24 220.130.131.238/32
http_access allow our_networks
:
#Default:
extension_methods REPORT MERGE MKACTIVITY CHECKOUT

#  TAG: request_entities
:
:
#Default:
# none
visible_hostname xen-www

#  TAG: unique_hostname
  • 如果需要設定 Proxy 使用者的帳號密碼, 就執行以下這部分
vi /etc/squid/squid.conf
:
auth_param basic program /usr/lib/squid/ncsa_auth /etc/squid/passwd
:
acl password proxy_auth REQUIRED
http_access allow password
:
  • 第一次建立帳號
    htpasswd -c /etc/squid/passwd jonathan

  • 之後建立帳號或修改密碼

    htpasswd /etc/squid/passwd tryweb

3 第一次啟動與設定自動啟動

service squid start
chkconfig squid on
chkconfig --list | grep squid
[root@tryboxap01 squid]# service squid start
init_cache_dir /var/spool/squid... 啟動 squid:.            [  確定  ]
[root@tryboxap01 squid]#
[root@tryboxap01 squid]# chkconfig squid on
[root@tryboxap01 squid]# chkconfig --list | grep squid
squid           0:off   1:off   2:on    3:on    4:on    5:on    6:off
[root@tryboxap01 squid]#

  • 要瞭解 Proxy 被存取狀況可以看 /var/log/squid/access.log 內容紀錄
  • 通常無法正常啟動可以依據 /var/log/squid/squid.out 的到解決方案

4 相關參考資料

 
回到頁頂
tech/squid.txt (3527) · 上一次變更: 2011-09-16 10:26 由 jonathan
 
 
CC Attribution-Share Alike 3.0 Unported
chimeric.de = chi`s home Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0