squid3配置要點 首先需要apt-get update 然後安裝apt-get install squid 配置和開啟 vi /usr/local/squid/etc/squid.conf 3.1更改監聽連接埠 http_port 9090 3.2更改存取控制 http_access allow all 3.3開啟squid 3.3.1初始化squid.conf裡的cache目錄------------------非常重要的命令----------------- /usr/local/squid/sbin/squid -z 3.3.2對squid.conf進行排錯 /usr/local/squid/sbin/squid -k parse 3.3.3前台啟動squid /usr/local/squid/sbin/squid -N -d1 3.3.4後台運行squid /usr/local/squid/sbin/squid -s 3.3.5 停止 /usr/local/squid/sbin/squid -k shutdown 3.3.5重新引導修改過的squid.conf /usr/local/squid/sbin/squid -k reconfigure ----------------------本人配置,親測可用---------------2013/06/29 01:19:40| Processing Configuration File: /etc/squid3/squid.conf (depth 0)2013/06/29 01:19:40| Processing: acl manager proto cache_object2013/06/29 01:19:40| Processing: acl localhost src 127.0.0.1/32 ::12013/06/29 01:19:40| Processing: acl to_localhost dst 127.0.0.0/8 0.0.0.0/32 ::12013/06/29 01:19:40| Processing: acl localnet src 10.0.0.0/8 # RFC1918 possible internal network2013/06/29 01:19:40| Processing: acl SSL_ports port 4432013/06/29 01:19:40| Processing: acl Safe_ports port 80 # http2013/06/29 01:19:40| Processing: acl Safe_ports port 21 # ftp2013/06/29 01:19:40| Processing: acl Safe_ports port 443 # https2013/06/29 01:19:40| Processing: acl Safe_ports port 70 # gopher2013/06/29 01:19:40| Processing: acl Safe_ports port 210 # wais2013/06/29 01:19:40| Processing: acl Safe_ports port 1025-65535 # unregistered ports2013/06/29 01:19:40| Processing: acl Safe_ports port 280 # http-mgmt2013/06/29 01:19:40| Processing: acl Safe_ports port 488 # gss-http2013/06/29 01:19:40| Processing: acl Safe_ports port 591 # filemaker2013/06/29 01:19:40| Processing: acl Safe_ports port 777 # multiling http2013/06/29 01:19:40| Processing: acl CONNECT method CONNECT2013/06/29 01:19:40| Processing: http_access allow manager localhost2013/06/29 01:19:40| Processing: http_access allow localnet2013/06/29 01:19:40| Processing: http_access allow localhost2013/06/29 01:19:40| Processing: http_access allow all2013/06/29 01:19:40| Processing: http_port 0.0.0.0:31282013/06/29 01:19:40| Processing: cache_mem 1000 MB2013/06/29 01:19:40| Processing: maximum_object_size_in_memory 1024 KB2013/06/29 01:19:40| Processing: cache_dir ufs /var/spool/squid3 1024 16 2562013/06/29 01:19:40| Processing: maximum_object_size 32327 KB2013/06/29 01:19:40| Processing: cache_swap_low 902013/06/29 01:19:40| Processing: cache_swap_high 952013/06/29 01:19:40| Processing: access_log /var/log/squid3/access.log squid2013/06/29 01:19:40| Processing: cache_store_log /var/log/squid3/store.log2013/06/29 01:19:40| Processing: pid_filename /var/run/squid3.pid2013/06/29 01:19:40| Processing: cache_log /var/log/squid3/cache.log2013/06/29 01:19:40| Processing: coredump_dir /var/spool/squid32013/06/29 01:19:40| Processing: refresh_pattern ^ftp: 1440 20% 100802013/06/29 01:19:40| Processing: refresh_pattern ^gopher: 1440 0% 14402013/06/29 01:19:40| Processing: refresh_pattern -i (/cgi-bin/|\?) 0 0% 02013/06/29 01:19:40| Processing: refresh_pattern (Release|Packages(.gz)*)$ 0 20% 28802013/06/29 01:19:40| Processing: refresh_pattern . 0 20% 43202013/06/29 01:19:40| Processing: cache_mgr xxx2013/06/29 01:19:40| Processing: visible_hostname xxx.xxx.xxx.xxx2013/06/29 01:19:40| Processing: dns_nameservers xxx.xxx.xxx.xxx squid 最終的解決問題不在於上面的配置。而在於相關日誌、快取檔案的許可權;squid 3 顯示啟動:squid3 -N -d1,發現 直接賦予swap.state檔案夾許可權,即可。同時,對於access.log,cache.log 的日誌許可權也需要考慮提前變更。這些在squid3 -k parse 中就已經提到。 asset ion failure mem->swap out.sio=self 出現此錯誤,目前公網上找不到答案,唯一解決方案就是減少IP,不再分配新的ip;或者是通過squid3 -z 重新初始化目錄切記:以後再改動conf 檔案的時候,先將原來的檔案進行備份。