在 Ubuntu 上配置带有缓存和日志记录的 Squid3 代理服务器

在 Ubuntu 上配置带有缓存和日志记录的 Squid3 代理服务器

我有一台 ubuntu 11.10 机器。安装了 Squid3。当我将 squid 配置为 http_access 允许所有时,一切正常。我当前的配置大多为默认配置,如下所示:

2012/09/10 13:19:57| Processing Configuration File: /etc/squid3/squid.conf (depth 0)
2012/09/10 13:19:57| Processing: acl manager proto cache_object
2012/09/10 13:19:57| Processing: acl localhost src 127.0.0.1/32 ::1
2012/09/10 13:19:57| Processing: acl to_localhost dst 127.0.0.0/8 0.0.0.0/32 ::1
2012/09/10 13:19:57| Processing: acl SSL_ports port 443
2012/09/10 13:19:57| Processing: acl Safe_ports port 80     # http
2012/09/10 13:19:57| Processing: acl Safe_ports port 21     # ftp
2012/09/10 13:19:57| Processing: acl Safe_ports port 443        # https
2012/09/10 13:19:57| Processing: acl Safe_ports port 70     # gopher
2012/09/10 13:19:57| Processing: acl Safe_ports port 210        # wais
2012/09/10 13:19:57| Processing: acl Safe_ports port 1025-65535 # unregistered ports
2012/09/10 13:19:57| Processing: acl Safe_ports port 280        # http-mgmt
2012/09/10 13:19:57| Processing: acl Safe_ports port 488        # gss-http
2012/09/10 13:19:57| Processing: acl Safe_ports port 591        # filemaker
2012/09/10 13:19:57| Processing: acl Safe_ports port 777        # multiling http
2012/09/10 13:19:57| Processing: acl CONNECT method CONNECT
2012/09/10 13:19:57| Processing: http_access allow manager localhost
2012/09/10 13:19:57| Processing: http_access deny manager
2012/09/10 13:19:57| Processing: http_access deny !Safe_ports
2012/09/10 13:19:57| Processing: http_access deny CONNECT !SSL_ports
2012/09/10 13:19:57| Processing: http_access allow localhost
2012/09/10 13:19:57| Processing: http_access deny all
2012/09/10 13:19:57| Processing: http_port 3128
2012/09/10 13:19:57| Processing: coredump_dir /var/spool/squid3
2012/09/10 13:19:57| Processing: refresh_pattern ^ftp:      1440    20% 10080
2012/09/10 13:19:57| Processing: refresh_pattern ^gopher:   1440    0%  1440
2012/09/10 13:19:57| Processing: refresh_pattern -i (/cgi-bin/|\?) 0    0%  0
2012/09/10 13:19:57| Processing: refresh_pattern (Release|Packages(.gz)*)$      0       20%     2880
2012/09/10 13:19:57| Processing: refresh_pattern .      0   20% 4320
2012/09/10 13:19:57| Processing: http_access allow all
2012/09/10 13:19:57| Processing: cache_mem 512 MB
2012/09/10 13:19:57| Processing: logformat squid3 %ts.%03tu %6tr %>a %Ss/%03>Hs %<st %rm %ru
2012/09/10 13:19:57| Processing: access_log /home/panshul/squidCache/log/access.log squid3

当我启用以下行时,问题就开始了:

access_log /home/panshul/squidCache/log/access.log

我开始proxy server is refusing connections error进入浏览器。在我的配置中注释掉上面那行后,一切恢复正常。

当我在配置中添加以下行时,第二个问题开始出现:

cache_dir ufs /home/panshul/squidCache/cache 100 16 256

squid 服务器启动失败。

任何建议,我在配置中缺少什么。请帮忙。!!

答案1

Debian/Ubuntu 系统上 squid 的默认配置将以用户/组身份运行proxy/proxy

对于您的问题,最简单且最可能的解释是,squid 没有以用户身份拥有的权限对该文件夹进行写访问proxy

除非您有非常充分的理由,否则您可能应该将日志记录和缓存保留在默认位置/var/log/squid3//var/spool/squid3/正确设置权限。

相关内容