ubuntu 下的squid安装日志

本文详细介绍在Ubuntu 9.0.4上安装、配置Squid代理服务器的过程,包括解决安装过程中的编译错误、配置文件调整以实现正常运行及权限问题的处理等关键步骤。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

ubuntu 9.0.4

1) 安装

wget http://www.squid-cache.org/Versions/v3/3.0/squid-3.0.STABLE20.tar.gz tar xzvf squid-3.0.STABLE20.tar.gz cd squid-3.0.STABLE20/ ./configure --prefix=/path/to/squid

遇到问题
checking for C++ compiler default output file name...
configure: error: C++ compiler cannot create executables
See `config.log' for more details.
configure: error: ./configure failed for lib/libTrie

解决:
sudo apt-get install g++

重新编译 ok

make &&  make install

2)配置

在${squid_home}/etc/squid.cof中加入

#配置 squid 为加速模式 http_port 80 accel vhost vport #配置反向代理的服务器 ,originserver 参数指明是源服务器, cache_peer 127.0.0.1 parent 8080 0 no-query originserver

验证配置

${squid_home}/sbin/squid – k parse

3)生成缓存目录

${squid_home}/sbin/squid -z

默认会在${squid_home}/var/cache下生成一堆目录

4)启动

sudo ${squid_home}/sbin/squid

发现问题:
squid进程起来了,但很快消失,并有错误日志

FATAL: Cannot open '/home/pwlazy/dev/squid/var/logs/access.log' for writing.
The parent directory must be writeable by the
user 'nobody', which is the cache_effective_user
set in squid.conf.

解决:
sudo chown -R nobody /home/pwlazy/dev/squid/var/logs/access.log
再次启动,发现问题:
FATAL: Cannot open '/home/pwlazy/dev/squid/var/logs/store.log' for writing.
The parent directory must be writeable by the
user 'nobody', which is the cache_effective_user
set in squid.conf.
解决:
sudo chown -R nobody /home/pwlazy/dev/squid/var/logs/store.log
再次仍然问题
2009/11/14 02:31:38| /home/pwlazy/dev/squid/var/cache/00: (13) Permission denied
FATAL: Failed to verify one of the swap directories, Check cache.log
for details. Run 'squid -z' to create swap directories
if needed, or if running Squid for the first time.

解决
sudo chown -R nobody /home/pwlazy/dev/squid/var/cache

上面的问题非常类似,总结一下:
squid起来之后会有一个父进程,和1个或者多个工作进程,这些工作进程会读写access.log和store.log以及cache目录
而父进程会读写cache.log

5)从页面访问

http://127.0.0.1

发现问题:
403

解决:
于是修改配置文件,
将http_access deny all改为
http_access allow all
再次访问ok

6)清除缓存

bin/squidclient -m PURGE -p 80 "http://127.0.01/"

发现问题

403

解决
acl AdminBoxes src 127.0.0.1 acl Purge method PURGE http_access allow AdminBoxes Purge http_access deny Purge

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值