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     如需转载请自行联系原作者

相关文章
|
2月前
|
弹性计算 ice
阿里云4核8G云服务器配置价格:热门ECS实例及CPU处理器型号说明
阿里云2025年4核8G服务器配置价格汇总,涵盖经济型e实例、计算型c9i等热门ECS实例,CPU含Intel Xeon及AMD EPYC系列,月费159元起,年付低至1578元,按小时计费0.45元起,实际购买享折扣优惠。
457 1
|
2月前
|
弹性计算 定位技术 数据中心
阿里云服务器配置选择方法:付费类型、地域及CPU内存配置全解析
阿里云服务器怎么选?2025最新指南:就近选择地域,降低延迟;长期使用选包年包月,短期灵活选按量付费;企业选2核4G5M仅199元/年,个人选2核2G3M低至99元/年,高性价比爆款推荐,轻松上云。
171 11
|
2月前
|
存储 弹性计算 监控
阿里云渠道商:如何挑选阿里云服务器配置?
本文详解通用型、计算型、内存型等实例适用场景,结合性能评估与成本优化策略,助力用户按需选择。以日均1万访问企业网站为例,2核4G+3M带宽月费约200元,性价比高。合理配置更省钱。
|
2月前
|
存储 弹性计算 网络协议
超详细的阿里云服务器购买流程,ECS自定义购买配置教程
本文详细图解阿里云ECS服务器自定义购买全流程,涵盖付费模式、地域选择、网络配置、实例规格、镜像、存储、安全组及登录设置等核心步骤,助您轻松掌握专业级云服务器搭建方法。
|
2月前
|
弹性计算
阿里云ECS云服务器8核16G配置收费价格,多种ECS实例CPU及费用清单
阿里云8核16G云服务器价格因实例类型而异。计算型c9i约743元/月,一年6450元(7折);通用算力型u1仅673元/月,一年4225元(5.1折)。实际价格享时长折扣,详情见ECS官网。
|
弹性计算 Shell Windows
阿里云学生专享ecs服务器体验及个人配置
阿里云学生优惠专享的云服务器个人使用体验
阿里云学生专享ecs服务器体验及个人配置
|
2月前
|
弹性计算 运维 安全
阿里云轻量应用服务器与云服务器ECS啥区别?新手帮助教程
阿里云轻量应用服务器适合个人开发者搭建博客、测试环境等低流量场景,操作简单、成本低;ECS适用于企业级高负载业务,功能强大、灵活可扩展。二者在性能、网络、镜像及运维管理上差异显著,用户应根据实际需求选择。
241 10
|
2月前
|
运维 安全 Ubuntu
阿里云渠道商:服务器操作系统怎么选?
阿里云提供丰富操作系统镜像,涵盖Windows与主流Linux发行版。选型需综合技术兼容性、运维成本、安全稳定等因素。推荐Alibaba Cloud Linux、Ubuntu等用于Web与容器场景,Windows Server支撑.NET应用。建议优先选用LTS版本并进行测试验证,通过标准化镜像管理提升部署效率与一致性。