varsh4.1 安装清除cache
yum install automake autoconf ncurses-devel libxslt groff pkgconfig python-docutils readline-devel -y
yum install gcc gcc-c++ make openssl-devel pcre-devel -y
useradd -s /sbin/nologin varnish
mkdir -p /data/varnish/cache
mkdir /data/varnish/log
mkdir /data/varnish/etc
chown -R varnish:varnish /data/varnish/cache
chown -R varnish:varnish /data/varnish/log
export PKG_CONFIG_PATH=/usr/lib64/pkgconfig
tar xf varnish-4.1.0.tar.gz
cd varnish-4.1.0
./configure --prefix=/data/varnish/ --enable-dependency-tracking --enable-developer-warnings --enable-debugging-symbols
make
make install
#,--enable-developer-warnings是指启用提示警告,默认情况下是NO,--enable-debugging-symbols是调试一些bug信息的标志。
/data/varnish/bin/varnishlog -a -w /tmp/varnish.log #启动日志
/data/varnish/sbin/varnishd -f /data/varnish/etc/default.vcl -s malloc,1024m -T 127.0.0.1:2000 -a 0.0.0.0:80
#
varnishadm "ban req.url ~ ." #清除所有缓存
varnishadm "ban req.url ~ .jpg" #清除jpg格式的文件
if (req.url ~ "^[^?]*\.(bmp|bz2|mp3|css|doc|eot|flv|gif|gz|ico|jpeg|jpg|apk|js|less|pdf|png|rtf|swf|txt|woff|xml)(\?.*)?$") {
unset req.http.Cookie;
return (hash);
}
#缓存静态文件
#-----------------------------------------------------------------------------------------------#
if (req.http.Accept-Encoding) {
if (req.url ~ "\.(jpg|png|gif|gz|tgz|bz2|tbz|ogg)$") {
# No point in compressing these
unset req.http.Accept-Encoding;
} elsif (req.http.Accept-Encoding ~ "gzip") {
set req.http.Accept-Encoding = "gzip";
} elsif (req.http.Accept-Encoding ~ "deflate") {
set req.http.Accept-Encoding = "deflate";
} else {
# unkown algorithm
unset req.http.Accept-Encoding;
}
}
# Large static files should be piped, so they are delivered directly to the end-user without
# waiting for Varnish to fully read the file first.
# TODO: once the Varnish Streaming branch merges with the master branch, use streaming here to avoid locking.
if (req.url ~ "^[^?]*\.(rar|tar|tgz|gz|wav|zip)(\?.*)?$") {
unset req.http.Cookie;
return (pipe);
}
#不缓存这些格式的文件
#-----------------------清除指定域名的缓存-------------------------#
#!/bin/bash
if [ $# == 0 ];then
echo "请传入一个域名作为参数,例如: $0 source.cinyi.com"
else
/data/varnish/bin/varnishadm ban req.http.host == "$1"
fi
[ $? == 0 ]&&echo "$1 缓存清除成功"
varsh4.1 安装清除cache的更多相关文章
- Android中应用程序清除data/data,清除cache,超详细
清除data,清除cache,其实在Android原生Setting里面有这个功能的. 需求是把这个功能做到自己的App里面,并计算出cache和data的size. 所以参考了一下Setting的源 ...
- JxBrowser之五:清除cache和cookie以及SSL证书处理
1.清除cache和cookie //清除cache browser.getCacheStorage().clearCache(); browser.getLocalWebStorage().clea ...
- linux中清除cache的方法
在进行测试文件导入的时候,发现内存占用很大,如下所示: [root@python ~]# vmstat 1 -S M 3 procs -----------memory---------- ---sw ...
- linux清除cache的方法
1 Linux下内存占用多的原因 当linux第一次读取一个文件运行时,一份放到一片内存中cache起来,另一份放入运行程序的内存中,正常运行,当程序运行完,关闭了,cache中的那一分却没有释放, ...
- CentOS7下安装Python的pip
root用户使用yum install -y python-pip 时会报如下错误: No package python-pip available Error:Nothing to do 解决方法如 ...
- centos安装Python2.7
1. 查看本机系统及python版本 # cat /etc/redhat-release CentOS release 6.7 (Final) 查看CentOS release 6.7 (Final) ...
- 三台CentOS 5 Linux LVS 的DR 模式http负载均衡安装步骤
Linux负载均衡软件LVS(概念篇) 一. LVS简介 LVS是Linux Virtual Server的简称,也就是Linux虚拟服务器, 是一个由章文嵩博士发起的自由软件项目,它的官方站点是ww ...
- 在centos,docker中安装HeadlessChrome
在centos6中安装chrome与chrome-driver,中间走了很多弯路,遇到很多坑,现将详细步骤总结如下.参考博客链接:https://blog.csdn.net/u013849486/ar ...
- centos7安装pip
转自:https://www.cnblogs.com/mangoVic/p/6428369.html 默认情况下,centos7是没有pip的,可以通过如下命令安装 首先安装epel扩展源: yum ...
随机推荐
- Logistic回归 python实现
Logistic回归 算法优缺点: 1.计算代价不高,易于理解和实现2.容易欠拟合,分类精度可能不高3.适用数据类型:数值型和标称型 算法思想: 其实就我的理解来说,logistic回归实际上就是加了 ...
- Monitoring Processes with Supervisord
If you're interested in more of this type of content, check out the Servers for Hackers eBook! As so ...
- 浏览器控制台console
console对象 console对象代表浏览器的JavaScript控制台.虽然它还不是标准,但是各大浏览器都原生支持,已经成为事实上的标准. console对象主要有两个作用: 显示网页代码运行时 ...
- UIView--震动效果
//震动效果- (void)shake:(UIView *)view{ CGRect frame = view.frame; CAKeyframeAnimation *shakeAnimation = ...
- 同一台机子上用多个git 账号
Step 1 - Create a New SSH Key We need to generate a unique SSH key for our second GitHub account. 1 ...
- Struts2 整合Spring(Maven,注解版)
这两天正在试验Struts2与Spring框架的整合,和他们各自的“注解”.今天就总结一下这两个框架怎么用注解进行整合. 一,加入两者的依赖包,除了两者的必要依赖外,还需要导入struts2-spri ...
- Java 开发环境的搭建
配置JDK安装路径 1——JAVA_HOME 2——CLASSPATH 配置类库文件位置(特别注意:路径前面的”. “ 代表当前路径,分号用来区分路径) 3——PATH ...
- Invoke-Command和-ComputerName 效率比较
看到网上有文章说Invoke-Command的方式相较其他方式的效率要高,特地试验了一下,但是这个实验不是很好: 机器只有2台 0. 用Get-WinEvent,日志数=200,Invoke方式快 1 ...
- insert操作卡死的处理过程
insert操作卡死的处理过程 先看看insert为什么被卡死 SQL> select sql_id from v$sql where sql_text like 'delete from st ...
- Centos防火墙禁止ping和开启ping
1.允许PING设置 iptables -A INPUT -p icmp --icmp-type echo-request -j ACCEPT iptables -A OUTPUT -p icmp - ...