centos7配置squid代理服务器

简介:
  1. 服务器列表:
    角色                内网ip                外网ip
    squid服务器   192.168.8.81     192.168.8.252
    web1服务器   192.168.8.83     -
    web2服务器   192.168.8.84     -
  2. squid服务器配置:
    a. 内网配置:
    cat /etc/sysconfig/network-scripts/ifcfg-eth0
    centos7配置squid代理服务器
    b. 外网配置:
    cat /etc/sysconfig/network-scripts/ifcfg-eth1
    centos7配置squid代理服务器
    c. 安装:
    yum -y install squid
    d. 修改配置文件:
    vim /etc/squid/squid.conf
    centos7配置squid代理服务器
    e. 配置文件原代码:
    acl manager proto cache_object
    acl localnet src 127.0.0.1/32 ::1
    acl localnet src 192.168.8.0/24
    acl localnet src fc00::/7       # RFC 4193 local private network range
    acl localnet src fe80::/10      # RFC 4291 link-local (directly plugged) machines
    acl SSL_ports port 443
    acl Safe_ports port 80      # http
    acl Safe_ports port 21      # ftp
    acl Safe_ports port 443     # https
    acl Safe_ports port 70      # gopher
    acl Safe_ports port 210     # wais
    acl Safe_ports port 1025-65535  # unregistered ports
    acl Safe_ports port 280     # http-mgmt
    acl Safe_ports port 488     # gss-http
    acl Safe_ports port 591     # filemaker
    acl Safe_ports port 777     # multiling http
    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
    visible_hostname lee.com
    cache_mem 2048 MB 
    maximum_object_size 4096 KB
    cache_dir ufs /var/spool/squid 800 16 256
    error_directory /usr/share/squid/errors/zh-cn
    cache_log /var/log/squid/cache_log
    cache_mgr complet@163.com
    http_port 80 accel vhost
    http_port 3128
    cache_peer 192.168.8.83 parent 80 0 no-query originserver round-robin name=server1
    cache_peer 192.168.8.84 parent 80 0 no-query originserver round-robin name=server2
    refresh_pattern ^ftp:       1440    20% 10080
    refresh_pattern ^gopher:    1440    0%  1440
    refresh_pattern -i (/cgi-bin/|\?) 0 0%  0
    refresh_pattern .       0   20% 4320

    f. 配置防火墙规则(开启3128端口):
    iptables -I INPUT -p tcp --dport 3128 -j ACCEPT
    g. 关闭apache:
    systemctl stop httpd

  3. web1服务器配置:
    a. 内网配置:
    cat /etc/sysconfig/network-scripts/ifcfg-eth0
    centos7配置squid代理服务器
    b. 关闭防火墙:
    systemctl stop firewalld
  4. web2服务器配置(参照web1):
  5. 浏览器访问(192.168.8.252):
    a. 页面一:
    centos7配置squid代理服务器
    b. 页面二:
    centos7配置squid代理服务器
本文转自 Lee_吉  博客,原文链接:    http://blog.51cto.com/12173069/2061841     如需转载请自行联系原作者

相关文章
|
7天前
|
消息中间件 安全 Unix
SSH配置多台服务器之间的免密登陆以及登陆别名
SSH配置多台服务器之间的免密登陆以及登陆别名
18 1
|
22天前
|
弹性计算
2024年阿里云服务器不同实例规格与配置实时优惠价格整理与分享
2024年阿里云服务器的优惠价格新鲜出炉,有特惠云服务器也有普通优惠价格,本文为大家整理汇总了2024年阿里云服务器的优惠价格,包含特惠云服务器和其他配置云服务器的优惠价格。以便大家了解自己想购买的云服务器选择不同实例规格和带宽情况下的价格,仅供参考。
2024年阿里云服务器不同实例规格与配置实时优惠价格整理与分享
|
4天前
|
存储 弹性计算 安全
阿里云服务器2核2G、2核4G配置最新租用收费标准及活动价格参考
2核2G、2核4G配置是很多个人和企业建站以及部署中小型的web应用等场景时首选的云服务器配置,这些配置的租用价格也是用户非常关心的问题,本文为大家整理汇总了2024年阿里云服务器2核2G、2核4G配置不同实例规格及地域之间的收费标准,同时整理了这些配置最新活动价格,以供大家参考和选择。
阿里云服务器2核2G、2核4G配置最新租用收费标准及活动价格参考
|
7天前
|
域名解析 网络协议 应用服务中间件
阿里云服务器配置免费https服务
阿里云服务器配置免费https服务
|
10天前
|
网络协议
centos8 网卡 Nmcli(是network的简写 Nmcli)配置网络
centos8 网卡 Nmcli(是network的简写 Nmcli)配置网络
14 0
|
10天前
|
数据采集
robots.txt配置 减小服务器压力
robots.txt配置 减小服务器压力
13 0
|
10天前
|
Linux
centos 查看服务器信息 版本cpu
centos 查看服务器信息 版本cpu
9 0
|
21天前
|
网络协议 Linux 网络安全
Linux服务器DNS服务器配置实现bind的正向解释和反向解释
Linux服务器DNS服务器配置实现bind的正向解释和反向解释
17 0
|
22天前
|
弹性计算 网络安全 虚拟化
ECS数据问题之升级配置预防数据丢失如何解决
ECS(Elastic Compute Service,弹性计算服务)是云计算服务提供商提供的一种基础云服务,允许用户在云端获取和配置虚拟服务器。以下是ECS服务使用中的一些常见问题及其解答的合集:
|
23天前
|
弹性计算 Kubernetes 安全
ECS选型推荐配置
在构建Kubernetes集群时,应避免使用过多小规格ECS,因它们可能带来网络限制、容量不足和资源碎片化问题。采用大规格ECS能提升网络性能,优化镜像拉取效率。选择Master节点时,要考虑集群规模,生产环境建议选择较高规格。Worker节点推荐使用CPU≥4核、内存≥8GiB的ECS,根据集群总核数和容错率来决定节点数量。当规模达1000核,可选用裸金属神龙服务器,它提供超强网络、零计算抖动和安全性能,适合大促等需快速扩展的场景。
25 1