squid
来源:百度文库 编辑:神马文学网 时间:2024/04/30 14:28:09
测试平台: Redhat linux7.2 squid-2.5.STABLE2
# cd /usr/local/squid/etc
# rm -rf /usr/local/squid
# mkdir -p /usr/local/squid/var/cache 删除原先记录,新建缓存目录
# cd /usr/local/src/squid-2.5.STABLE2 必须有X的权限
# export CFLAGES=‘-O2 -mcpu=i586‘
[root@test squid-2.5.STABLE2]# ./configure --prefix=/usr/local/squid \
> --enable-gnuregex --enable-async-io=80 --enable-icmp \
> --enable-kill-parent-hack --enable-snmp \
> --disable-ident-lookups --enable-cahce-digests \
> --enable-err-language="Traditional_Chinese" \
> --enable-poll --enable-linux-netfilter
[root@linux72r squid]# ./configure --prefix=/usr/local/squid --enable-gnuregex --enable-async-io=80 --enable-icmp --enable-kill-parent-hack --enable-snmp --disable-ident-lookups --enable-cahce-digests --enable-err-language="Traditional_Chinese" --enable-poll --enable-linux-netfilter
# make && make install
# useradd squid0
# passwd squid0 建立一个普通的帐号squid0,也可以用nobody或squid 但这两个帐号的密码不更变掉
# cd /usr/local/squid/etc
# vi squid.conf
# chown -R squid0:squid0 /usr/local/squid 第一步 必须修改成启用者的使用权限
# /usr/local/squid/sbin/squid -z 第二步 这两步的顺序不能颠倒,不然squid就不能启动了
# su -l squid0
$ /usr/local/squid/sbin/squid -D 去掉DNS检测的启动,当你在LAN中linux没连接internet时 squid的启动方式
则 # su -l squid0 -c "/usr/local/squid/sbin/squid -D"
# su -l squid0 -c "/usr/local/squid/bin/RunCache &" 当linux连接了initernet时的启动方式,会自动检测DNS
# netstat -tln | grep 3128
squid.conf 修改
http_port 3128
visible_hostname linux72r
cache_dir aufs /usr/local/squid/var/cache 384 16 256
cache_access_log /usr/local/squid/var/logs/access.log
cache_log /usr/local/squid/var/logs/cache.log
cache_store_log /usr/local/squid/var/logs/store.log
pid_filename /usr/local/squid/var/logs/squid.pid
http_access allow all
cache_effective_user oice
cache_effective_group oice
=====================================================
我的代理server实验手记
[root@linux72 root]# cat /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=linux72
[root@linux72 root]# cat /etc/sysconfig/network-scripts/ifcfg-eth0 接内部的LAN
DEVICE=eth0
BOOTPROTO=static
BROADCAST=10.10.7.255
IPADDR=10.10.6.10
NETMASK=255.255.248.0
NETWORK=10.10.0.0
GATEWAY=10.10.1.1
ONBOOT=yes
[root@linux72 root]# cat /etc/sysconfig/network-scripts/ifcfg-eth1 用交叉线连接“SMC 本地连接”网卡
DEVICE=eth1
BOOTPROTO=static
BROADCAST=192.168.0.255
IPADDR=192.168.0.2
NETMASK=255.255.255.0
NETWORK=192.168.0.0
GATEWAY=192.168.0.1
ONBOOT=yes
[root@linux72 root]# cat /etc/resolv.conf
nameserver 192.168.0.1 GATEWAY 和 DNS 都要设置成 192.168.0.1
nameserver 202.96.128.166
nameserver 10.10.7.32
nameserver 202.96.128.68
[root@linux72 root]# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.0.0 0.0.0.0 255.255.255.0 U 0 0 0 eth1
10.10.0.0 0.0.0.0 255.255.248.0 U 0 0 0 eth0
127.0.0.0 0.0.0.0 255.0.0.0 U 0 0 0 lo
0.0.0.0 192.168.0.1 0.0.0.0 UG 0 0 0 eth1
0.0.0.0 10.10.1.1 0.0.0.0 UG 0 0 0 eth0
[root@linux72 root]# route add default gw 192.168.0.1 eth1 这个指令很重要,不然 LINUX无法访问INTERNET,更不要说SQUID了
[root@linux72 root]# su -l squid -c "/usr/local/squid/sbin/squid -D"
[root@linux72 root]# /etc/init.d/network restart
[root@linux72 root]# /etc/rc.d/init.d/xinetd restart
[root@linux72 root]# cat /etc/rc.d/rc.local 让其开机自动运行squid
#!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don‘t
# want to do the full Sys V style init stuff.
touch /var/lock/subsys/local
route add default gw 192.168.0.1 eth1
su -l squid -c "/usr/local/squid/sbin/squid -D"
[我的linux之路]关闭squid1. ps -ef | grep squid 2. kill squid_process_id(例如:kill 581) 3. tail cache.log 或 ps -ef | grep squid 查看squid是否已被 kill 掉了. 4. cd /export/home/squid/bin 5. ./squid -k shutdown (将squid 依正常程序 shutdown) 6. 用ps -ef 看是否有dnsserver, squid 等程式在跑,若无则可以关机。
# cd /usr/local/squid/etc
# rm -rf /usr/local/squid
# mkdir -p /usr/local/squid/var/cache 删除原先记录,新建缓存目录
# cd /usr/local/src/squid-2.5.STABLE2 必须有X的权限
# export CFLAGES=‘-O2 -mcpu=i586‘
[root@test squid-2.5.STABLE2]# ./configure --prefix=/usr/local/squid \
> --enable-gnuregex --enable-async-io=80 --enable-icmp \
> --enable-kill-parent-hack --enable-snmp \
> --disable-ident-lookups --enable-cahce-digests \
> --enable-err-language="Traditional_Chinese" \
> --enable-poll --enable-linux-netfilter
[root@linux72r squid]# ./configure --prefix=/usr/local/squid --enable-gnuregex --enable-async-io=80 --enable-icmp --enable-kill-parent-hack --enable-snmp --disable-ident-lookups --enable-cahce-digests --enable-err-language="Traditional_Chinese" --enable-poll --enable-linux-netfilter
# make && make install
# useradd squid0
# passwd squid0 建立一个普通的帐号squid0,也可以用nobody或squid 但这两个帐号的密码不更变掉
# cd /usr/local/squid/etc
# vi squid.conf
# chown -R squid0:squid0 /usr/local/squid 第一步 必须修改成启用者的使用权限
# /usr/local/squid/sbin/squid -z 第二步 这两步的顺序不能颠倒,不然squid就不能启动了
# su -l squid0
$ /usr/local/squid/sbin/squid -D 去掉DNS检测的启动,当你在LAN中linux没连接internet时 squid的启动方式
则 # su -l squid0 -c "/usr/local/squid/sbin/squid -D"
# su -l squid0 -c "/usr/local/squid/bin/RunCache &" 当linux连接了initernet时的启动方式,会自动检测DNS
# netstat -tln | grep 3128
squid.conf 修改
http_port 3128
visible_hostname linux72r
cache_dir aufs /usr/local/squid/var/cache 384 16 256
cache_access_log /usr/local/squid/var/logs/access.log
cache_log /usr/local/squid/var/logs/cache.log
cache_store_log /usr/local/squid/var/logs/store.log
pid_filename /usr/local/squid/var/logs/squid.pid
http_access allow all
cache_effective_user oice
cache_effective_group oice
=====================================================
我的代理server实验手记
[root@linux72 root]# cat /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=linux72
[root@linux72 root]# cat /etc/sysconfig/network-scripts/ifcfg-eth0 接内部的LAN
DEVICE=eth0
BOOTPROTO=static
BROADCAST=10.10.7.255
IPADDR=10.10.6.10
NETMASK=255.255.248.0
NETWORK=10.10.0.0
GATEWAY=10.10.1.1
ONBOOT=yes
[root@linux72 root]# cat /etc/sysconfig/network-scripts/ifcfg-eth1 用交叉线连接“SMC 本地连接”网卡
DEVICE=eth1
BOOTPROTO=static
BROADCAST=192.168.0.255
IPADDR=192.168.0.2
NETMASK=255.255.255.0
NETWORK=192.168.0.0
GATEWAY=192.168.0.1
ONBOOT=yes
[root@linux72 root]# cat /etc/resolv.conf
nameserver 192.168.0.1 GATEWAY 和 DNS 都要设置成 192.168.0.1
nameserver 202.96.128.166
nameserver 10.10.7.32
nameserver 202.96.128.68
[root@linux72 root]# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.0.0 0.0.0.0 255.255.255.0 U 0 0 0 eth1
10.10.0.0 0.0.0.0 255.255.248.0 U 0 0 0 eth0
127.0.0.0 0.0.0.0 255.0.0.0 U 0 0 0 lo
0.0.0.0 192.168.0.1 0.0.0.0 UG 0 0 0 eth1
0.0.0.0 10.10.1.1 0.0.0.0 UG 0 0 0 eth0
[root@linux72 root]# route add default gw 192.168.0.1 eth1 这个指令很重要,不然 LINUX无法访问INTERNET,更不要说SQUID了
[root@linux72 root]# su -l squid -c "/usr/local/squid/sbin/squid -D"
[root@linux72 root]# /etc/init.d/network restart
[root@linux72 root]# /etc/rc.d/init.d/xinetd restart
[root@linux72 root]# cat /etc/rc.d/rc.local 让其开机自动运行squid
#!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don‘t
# want to do the full Sys V style init stuff.
touch /var/lock/subsys/local
route add default gw 192.168.0.1 eth1
su -l squid -c "/usr/local/squid/sbin/squid -D"
[我的linux之路]关闭squid1. ps -ef | grep squid 2. kill squid_process_id(例如:kill 581) 3. tail cache.log 或 ps -ef | grep squid 查看squid是否已被 kill 掉了. 4. cd /export/home/squid/bin 5. ./squid -k shutdown (将squid 依正常程序 shutdown) 6. 用ps -ef 看是否有dnsserver, squid 等程式在跑,若无则可以关机。
squid
squid使用
squid 资料
squid日志
SQUID反向代理squid.conf配置文件
Squid Frequently Asked Questions
squid日志3
squid日志4
squid日志1
squid 高级的选项
Squid中文权威指南
squid 日志清理
Squid | 架构研究室
Squid客户端SquidClient分析
如何删除squid 日志
squid 代理伺服器下載檔案掃毒設定
Squid安装参数
Squid启动参数详解
squid configure 选项
转贴:squid 优化指南
squid 代理伺服器下載檔案掃毒設定
squid故障汇总
squid代理服务器的搭建
Squid中文权威指南 http://blog.s135.com/book/squid/