首先需要apt-get update
然后安装apt-get install squid
3、配置和开启
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_object
2013/06/29 01:19:40| Processing: acl localhost src 127.0.0.1/32 ::1
2013/06/29 01:19:40| Processing: acl to_localhost dst 127.0.0.0/8 0.0.0.0/32 ::1
2013/06/29 01:19:40| Processing: acl localnet src 10.0.0.0/8 # RFC1918 possible internal network
2013/06/29 01:19:40| Processing: acl SSL_ports port 443
2013/06/29 01:19:40| Processing: acl Safe_ports port 80 # http
2013/06/29 01:19:40| Processing: acl Safe_ports port 21 # ftp
2013/06/29 01:19:40| Processing: acl Safe_ports port 443 # https
2013/06/29 01:19:40| Processing: acl Safe_ports port 70 # gopher
2013/06/29 01:19:40| Processing: acl Safe_ports port 210 # wais
2013/06/29 01:19:40| Processing: acl Safe_ports port 1025-65535 # unregistered ports
2013/06/29 01:19:40| Processing: acl Safe_ports port 280 # http-mgmt
2013/06/29 01:19:40| Processing: acl Safe_ports port 488 # gss-http
2013/06/29 01:19:40| Processing: acl Safe_ports port 591 # filemaker
2013/06/29 01:19:40| Processing: acl Safe_ports port 777 # multiling http
2013/06/29 01:19:40| Processing: acl CONNECT method CONNECT
2013/06/29 01:19:40| Processing: http_access allow manager localhost
2013/06/29 01:19:40| Processing: http_access allow localnet
2013/06/29 01:19:40| Processing: http_access allow localhost
2013/06/29 01:19:40| Processing: http_access allow all
2013/06/29 01:19:40| Processing: http_port 0.0.0.0:3128
2013/06/29 01:19:40| Processing: cache_mem 1000 MB
2013/06/29 01:19:40| Processing: maximum_object_size_in_memory 1024 KB
2013/06/29 01:19:40| Processing: cache_dir ufs /var/spool/squid3 1024 16 256
2013/06/29 01:19:40| Processing: maximum_object_size 32327 KB
2013/06/29 01:19:40| Processing: cache_swap_low 90
2013/06/29 01:19:40| Processing: cache_swap_high 95
2013/06/29 01:19:40| Processing: access_log /var/log/squid3/access.log squid
2013/06/29 01:19:40| Processing: cache_store_log /var/log/squid3/store.log
2013/06/29 01:19:40| Processing: pid_filename /var/run/squid3.pid
2013/06/29 01:19:40| Processing: cache_log /var/log/squid3/cache.log
2013/06/29 01:19:40| Processing: coredump_dir /var/spool/squid3
2013/06/29 01:19:40| Processing: refresh_pattern ^ftp: 1440 20% 10080
2013/06/29 01:19:40| Processing: refresh_pattern ^gopher: 1440 0% 1440
2013/06/29 01:19:40| Processing: refresh_pattern -i (/cgi-bin/|\?) 0 0% 0
2013/06/29 01:19:40| Processing: refresh_pattern (Release|Packages(.gz)*)$ 0 20% 2880
2013/06/29 01:19:40| Processing: refresh_pattern . 0 20% 4320
2013/06/29 01:19:40| Processing: cache_mgr xxx
2013/06/29 01:19:40| Processing: visible_hostname xxx.xxx.xxx.xxx
2013/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 中就已经提到。
2013年7月16日
asset ion failure mem->swap out.sio=self 出现此错误,目前公网上找不到答案,唯一解决方案就是减少IP,不再分配新的ip;或者是通过squid3 -z 重新初始化目录
切记:以后再改动conf 文件的时候,先将原来的文件进行备份。
相关推荐
squid_配置详解
基于squid配置https的实践文档,基于自己实践写的,不是翻译的 主要是没分了,所以要点分哈
squid3配置参考手册
Squid 2.6 反向代理配置.doc, Squid 代理配置
squid的配置说明 squid:一款在linux下的代理服务器软件 功能相当强大
squid中文配置指南 包括配置步骤等信息。不过是介绍在linux和unix上的。
squid 安装配置,linux版本 阿呆收费
squid3.0压缩文件,linux上解压安装即可用 配置手册介绍了各配置及其参数
squid配置实用教程 squid配置实用教程
squid和nginx配置正向代理访问API接口
linux下Squid代理服务器的详细搭建配置。有图有真相哦!
1、 安装squid #rpm –ivh squid-*.rpm 2、 备份squid配置文件squid.conf #cp /etc/squid/squid.conf /home 3、 删除默认squid配置文件 #cd /etc/squid #rm –f squid.conf
目录 ...1.Net-snmp 获取与安装 1 2.Net-snmp 的配置 1 ...3.Squid 配置 4 4.Squid 测试 4 5.Squid 常用命令 5 6.Squid 其他 6 7.Squid.conf 配置实例 6 8.Squid.conf 配置说明 7 9.Squid命中率分析 11 10.Squid 排错 12
利用Squid配置Linux下代理服务器的说明文档,并结合一个示例说明
squid文件上传大小配置
NULL 博文链接:https://baobeituping.iteye.com/blog/1331539
Squid安装及详细配置
主要例出squid.conf的几种反向代理的配置例子
Squid工作原理 squid服务器的安装 squid服务启动前的准备 squid服务的启动与停止 squid服务的配置文件 ..... 简单明了
Linux Squid 代理修改配置 博文链接:https://xhy0422.iteye.com/blog/58601