`
rensanning
  • 浏览: 3548900 次
  • 性别: Icon_minigender_1
  • 来自: 大连
博客专栏
Efef1dba-f7dd-3931-8a61-8e1c76c3e39f
使用Titanium Mo...
浏览量:38156
Bbab2146-6e1d-3c50-acd6-c8bae29e307d
Cordova 3.x入门...
浏览量:607321
C08766e7-8a33-3f9b-9155-654af05c3484
常用Java开源Libra...
浏览量:682352
77063fb3-0ee7-3bfa-9c72-2a0234ebf83e
搭建 CentOS 6 服...
浏览量:89360
E40e5e76-1f3b-398e-b6a6-dc9cfbb38156
Spring Boot 入...
浏览量:401861
Abe39461-b089-344f-99fa-cdfbddea0e18
基于Spring Secu...
浏览量:69699
66a41a70-fdf0-3dc9-aa31-19b7e8b24672
MQTT入门
浏览量:91724
社区版块
存档分类
最新评论

搭建 CentOS 6 服务器(12) - squid、Varnish

 
阅读更多
(一)squid

安装
# yum -y install epel-release
# yum -y install squid


设置
# cp /etc/squid/squid.conf /etc/squid/squid.conf.bak

-Allow IP Address
# vi /etc/squid/squid.conf
    acl localnet src 192.168.21.0/24

-Changing Squid Port(Default 3128)
# vi /etc/squid/squid.conf
    http_port 5000

-Allow a Specific Port
# vi /etc/squid/squid.conf
    acl Safe_ports port 5432

-Blocking Websites
# vi /etc/squid/blocked_sites
    baidu.com
# vi /etc/squid/squid.conf
    acl blocked_sites dstdomain "/etc/squid/blocked_sites"
    http_access deny blocked_sites

-Using Basic Authentication
# yum -y install httpd-tools
# touch /etc/squid/passwd && chown squid /etc/squid/passwd
# htpasswd /etc/squid/passwd pxuser
# vi /etc/squid/squid.conf
    auth_param basic program /usr/lib64/squid/basic_ncsa_auth /etc/squid/passwd
    auth_param basic children 5
    auth_param basic realm Squid Basic Authentication
    auth_param basic credentialsttl 2 hours
    acl auth_users proxy_auth REQUIRED
    http_access allow auth_users

-Hide proxy
# vi /etc/squid/squid.conf
    forwarded_for off
    request_header_access Referer deny all
    request_header_access X-Forwarded-For deny all
    request_header_access Via deny all
    request_header_access Cache-Control deny all


启动服务
# /etc/init.d/squid start
# squid -v
    Squid Cache: Version 3.5.20
    Service Name: squid


# tail -f /var/log/squid/access.log


(二)Varnish

安装
# rpm --nosignature -i https://repo.varnish-cache.org/redhat/varnish-4.0.el6.rpm
# yum install -y varnish
# varnishd -V


设置
# vi /etc/sysconfig/varnish
    VARNISH_LISTEN_PORT=6081
# vi /etc/varnish/default.vcl
    backend default {
        .host = "127.0.0.1";
        .port = "81";
    }
# varnishd -C -f /etc/varnish/default.vcl


启动服务
# service varnish start
# service varnishncsa start
# service varnishlog start


确认
# varnishadm backend.list
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics