squid搭建
2016-01-01 15:41
666 查看
yum install -y squid
squid -v
更改配置文件
http_port 3128
acl manager proto cache_object
acl localhost src 127.0.0.1/32 ::1
acl to_localhost dst 127.0.0.0/8 0.0.0.0/32 ::1
acl localnet src 10.0.0.0/8 # RFC1918 possible internal network
acl localnet src 172.16.0.0/12 # RFC1918 possible internal network
acl localnet src 192.168.0.0/16 # RFC1918 possible internal network
acl SSL_ports port 443
acl Safe_ports port 80 8080 # http
acl Safe_ports port 21 # ftp
acl Safe_ports port 443 # https
acl CONNECT method CONNECT
http_access allow manager localhost
http_access deny manager
http_access deny !Safe_ports
http_access deny CONNECT !SSL_ports
http_access allow localnet
http_access allow localhost
http_access allow all
cache_dir aufs /data/cache 1024 16 256
cache_mem 128 MB
hierarchy_stoplist cgi-bin ?
coredump_dir /var/spool/squid
refresh_pattern ^ftp: 1440 20% 10080
refresh_pattern ^gopher: 1440 0% 1440
refresh_pattern -i (/cgi-bin/|\?) 0 0% 0
refresh_pattern \.(jpg|png|gif|mp3|xml) 1440 50% 2880 ignore-reload
refresh_pattern . 0 20% 4320
[root@localhost ~]# mkdir /data/cache
[root@localhost ~]# chown -R squid:squid /data/cache/
[root@localhost ~]# squid -z
[root@localhost ~]# /etc/init.d/squid start
curl -xlocalhost:3128 www.baidu.com
在acl http proto HTTP下添加
acl http proto HTTP
acl good_domain dstdomain .aaa.com .text.com
http_access allow http good_domain
http_access deny http !good_domain
acl http proto HTTP
acl bad_domain dstdomain .sina.com .souhu.com
http_access allow http !bad_domain
http_access deny http bad_domain
反向代理
http_port 80 accel vhost vport
cache_peer 180.97.33.108 parent 80 0 originserver name=a
cache_peer 101.226.103.106 parent 80 0 originserver name=b
cache_peer_domain a www.qq.com
cache_peer_domain b www.baidu.com
cache_peer 192.168.10.111 parent 80 0 originserver
squid -v
更改配置文件
http_port 3128
acl manager proto cache_object
acl localhost src 127.0.0.1/32 ::1
acl to_localhost dst 127.0.0.0/8 0.0.0.0/32 ::1
acl localnet src 10.0.0.0/8 # RFC1918 possible internal network
acl localnet src 172.16.0.0/12 # RFC1918 possible internal network
acl localnet src 192.168.0.0/16 # RFC1918 possible internal network
acl SSL_ports port 443
acl Safe_ports port 80 8080 # http
acl Safe_ports port 21 # ftp
acl Safe_ports port 443 # https
acl CONNECT method CONNECT
http_access allow manager localhost
http_access deny manager
http_access deny !Safe_ports
http_access deny CONNECT !SSL_ports
http_access allow localnet
http_access allow localhost
http_access allow all
cache_dir aufs /data/cache 1024 16 256
cache_mem 128 MB
hierarchy_stoplist cgi-bin ?
coredump_dir /var/spool/squid
refresh_pattern ^ftp: 1440 20% 10080
refresh_pattern ^gopher: 1440 0% 1440
refresh_pattern -i (/cgi-bin/|\?) 0 0% 0
refresh_pattern \.(jpg|png|gif|mp3|xml) 1440 50% 2880 ignore-reload
refresh_pattern . 0 20% 4320
[root@localhost ~]# mkdir /data/cache
[root@localhost ~]# chown -R squid:squid /data/cache/
[root@localhost ~]# squid -z
[root@localhost ~]# /etc/init.d/squid start
curl -xlocalhost:3128 www.baidu.com
在acl http proto HTTP下添加
acl http proto HTTP
acl good_domain dstdomain .aaa.com .text.com
http_access allow http good_domain
http_access deny http !good_domain
acl http proto HTTP
acl bad_domain dstdomain .sina.com .souhu.com
http_access allow http !bad_domain
http_access deny http bad_domain
反向代理
http_port 80 accel vhost vport
cache_peer 180.97.33.108 parent 80 0 originserver name=a
cache_peer 101.226.103.106 parent 80 0 originserver name=b
cache_peer_domain a www.qq.com
cache_peer_domain b www.baidu.com
cache_peer 192.168.10.111 parent 80 0 originserver
相关文章推荐
- 一个监控Squid运行进程数并自动重启的简洁Shell脚本分享
- 用DNSPod和Squid打造自己的CDN全程分享
- linux下安装Squid代理的详细配置教程
- PHP Squid中可缓存的动态网页设计
- WINDOWS系统下怎样配置squid做CDN的简明图解
- Windows下安装squid的步骤详解
- 清除指定squid缓存文件的脚本代码分享
- 用DNSPod和Squid打造自己的CDN(二)
- 在Windows下利用Squid开设代理服务器
- 基于Xen的VPS 配置squid服务器
- windows上面安装squid加速代理网站配置方法
- Squid集群做CDN全网加速配置分享
- CentOS下使用Squid架设CDN服务器的方法
- 用DNSPod和Squid打造自己的CDN (四)
- Shell脚本实现精准清除Squid缓存
- 用DNSPod和Squid打造自己的CDN (七) 配置Squid
- Linux下Squid配置详解 Squid代理服务器配置第1/3页
- 简单架设SSH+Squid代理服务器的自由上网通道的方法
- 用DNSPod和Squid打造自己的CDN (八) 测试并运行SQUID
- 用DNSPod和Squid打造自己的CDN (五) 安装Squid的前期准备