squid服务安装配置
时间:2021-12-03 来源:未知 投稿:admin 点击:次
注意:部署之前,先确认selinux处于关闭状态。
操作系统:CentOS7.*
yum install squid -y //安装服务
systemctl enable squid //设置开机启动。
mkdir -p /data/cache //创建缓存目录。
chown -R squid:squid /data/cache/ //设置缓存目录权限。
vi /etc/squid/squid.conf //进入配置文件。
清空原配置信息,添加如下内容。
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
acl Safe_ports port 21
acl Safe_ports port 443
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
cache_peer 222.187.225.225 parent 80 0 originserver name=www.fwqzx.com
cache_peer_domain www.fwqzx.com www.fwqzx.com
cache_peer 222.187.226.189 parent 85 0 originserver name=www.gwidc.com
cache_peer_domain www.gwidc.com www.gwidc.com
squid -z //初始化缓存目录 。
systemctl restart squid //重启squid服务
如果您的问题仍未解决,还可以加入服务器在线技术交流QQ群:8017413寻求帮助。
上一篇:没有了
下一篇:squid设置不缓存部分域名
下一篇:squid设置不缓存部分域名
相关内容
最新热点内容
推荐内容