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

(一)squid

安装
# yum install httpd-tools -y
# htpasswd -c -b /etc/squid/passwords squiduser 123456
# yum install squid -y


设置
# cp /etc/squid/squid.conf /etc/squid/squid.conf.bak
# vi /etc/squid/squid.conf
    auth_param basic program /usr/lib64/squid/ncsa_auth /etc/squid/passwords
    auth_param basic realm proxy
    acl authenticated proxy_auth REQUIRED
    http_access allow authenticated
    forwarded_for delete
    http_port 0.0.0.0:3128


启动服务
# /etc/init.d/squid start


(二)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

你可能感兴趣的:(varnish)