LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 1122|回复: 4

在arch上配制squid的反向代理

[复制链接]
发表于 2005-9-3 10:16:36 | 显示全部楼层 |阅读模式
系统:arch linux 0.7
Squid Cache: Version 2.5.STABLE10

注意:转载请注明来自:碧轩居 http://www.ourlinux.net

1. 安装
# pacman -Sy squid

2. 配制
只要一个文件:/etc/squid/squid.conf即可
我的如下:
cat /etc/squid/squid.conf

visible_hostname cache.ourlinux.net
http_port 80
icp_port 0
#不缓存url的正则表达式集合
acl QUERY urlpath_regex cgi-bin \? \.php \.jsp
no_cache deny QUERY
cache_mem 16 MB
#cache_dir aufs /tmp/squid 200 16 256
cache_dir aufs /var/cache/squid 200 16 256 # 注意这里红色部分,必须和/etc/rc.d/squid里的/var/cache/squid相对应,否则就无法启动
log_icp_queries off
buffered_logs on
emulate_httpd_log on
redirect_rewrites_host_header off
cache_replacement_policy GDSF
half_closed_clients off
acl all src 0.0.0.0/0.0.0.0
http_access allow all
cache_mgr bixuan@gmail.com
cache_effective_user proxy
cache_effective_group proxy
#缓存的服务器的地址(设定为virtual可以自动转向)
httpd_accel_host virtual
#缓存的服务器的端口
httpd_accel_port 80
log_icp_queries off
buffered_logs on

httpd_accel_with_proxy off
httpd_accel_uses_host_header on

#使用简体中文的出错信息
error_directory /usr/share/squid/errors/Simplify_Chinese
#########################################################
refresh_pattern ^ftp: 1440 20% 10080
refresh_pattern ^gopher: 1440 0% 1440
refresh_pattern -i .gif 10 40% 60 ignore-reload
refresh_pattern -i .jpg 10 40% 60 ignore-reload
refresh_pattern -i .htm 0 40% 60
refresh_pattern -i .html 0 40% 60
refresh_pattern -i .css 10 40% 60 ignore-reload
refresh_pattern -i .swf 10 40% 60 ignore-reload
refresh_pattern -i .cur 10 40% 60 ignore-reload
refresh_pattern -i .js$ 10 40% 60 ignore-reload
refresh_pattern . 0 20% 60

ie_refresh on

memory_pools on
forwarded_for on
log_icp_queries off
reload_into_ims on
#coredump_dir /tmp/squid/var

3. 启动
# /etc/rc.d/squid start
如果要在开机的时候自启动,则需要修改/etc/rc.conf
我的如下:
DAEMONS=(syslog-ng hotplug !pcmcia network netfs crond sshd httpd mysqld vsftd squid)

嘿嘿,多时的squid问题终于解决了
 楼主| 发表于 2005-9-3 10:54:51 | 显示全部楼层
下面的squid.conf配置是适合在同一机器上加速web

cat /etc/squid/squid.conf

visible_hostname cache.ourlinux.net
http_port 80
icp_port 0
acl QUERY urlpath_regex cgi-bin \? \.php
no_cache deny QUERY
cache_mem 16 MB
cache_dir aufs /var/cache/squid 100 16 256
log_icp_queries off
buffered_logs on
emulate_httpd_log on
redirect_rewrites_host_header off
cache_replacement_policy GDSF
half_closed_clients off
acl all src 0.0.0.0/0.0.0.0
http_access allow all
cache_mgr bixuan@gmail.com
cache_effective_user proxy
cache_effective_group proxy
httpd_accel_host virtual
httpd_accel_uses_host_header on
httpd_accel_port 81
httpd_accel_with_proxy off
回复 支持 反对

使用道具 举报

发表于 2005-9-10 11:25:17 | 显示全部楼层
Very good!
回复 支持 反对

使用道具 举报

发表于 2005-9-19 01:19:40 | 显示全部楼层
我怎么看了半天都没有找到反向代理的影子? 这个配置和一般的代理区别好象没有两样哦,唯一的地方就是把默认的3128改到了80.
请指教!
回复 支持 反对

使用道具 举报

 楼主| 发表于 2005-9-19 16:42:25 | 显示全部楼层
Post by changweitu
Very good!

提的很好!
忘了说一步:
在/etc/hosts/里加上注入:
Ip bbs.xxx.com
然后把:bbs.xxx.com的IP解吸到 squid所在机器的IP
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表