varnish安装维护

更新时间:2023-06-25 15:54:20 阅读: 评论:0

varnish安装维护
/varnish%E5%AE%89%E8%A3%85%E7%BB%B4%E6%8A%A4/
各文档所在位置
日志文件 /var/log/varnish/varnish.log
可执行程序 /usr/local/varnish/bin
缓冲文件 /var/vcache
配置文件 /usr/local/f
启动参数 /etc/sysconfig/varnish
启动脚本 /etc/rc.d/init.d/varnish
/etc/rc.d/init.d/varnishlog
创建www用户和组,以及Varnish缓存文件存放目录(/var/vcache):
/usr/sbin/groupadd www -g 48
/usr/sbin/uradd -u 48 -g www www
mkdir -p /var/vcache
chmod +w /var/vcache
chown -R www:www /var/vcache
创建日志文件,并授予www用户权限访问
mkdir -p /var/log/varnish
chmod +w /var/log/varnish
chown -R www:www /var/log/varnish
可能需要安装如下包
[CENTOS]yum install ncurs-devel
[UBUNTU]apt-get install libncurs5-dev
小狗日记编译安装
./configure –prefix=/usr/local/varnish
make
make install
编辑配置文件
vi /usr/local/f
view plaincopy to clipboardprint?
backend myblogrver {
t backend.host = 192.168.0.5;
t backend.port = 80;
}
acl purge {
localhost;
127.0.0.1;
192.168.1.0/24;
}
sub vcl_recv {
if (quest == PURGE) {
虾仁炒蛋
if (!client.ip ~ purge) {
error 405 Not allowed.;
}
lookup;
}
if (req.http.host ~ 君子兰肥料^) {
t req.backend = myblogrver;
if (quest != GET && quest != HEAD) {
pipe;
}
elif(req.url ~ \.(php|cgi)($|\?)) {
pass;
}
el {
lookup;
}
}
el {
error 404 Cache Server;
lookup;
}
}
sub vcl_hit {
if (quest == PURGE) {
l = 0s;
error 200 Purged.;
}
}
sub vcl_miss {
if (quest == PURGE意境网名”) {
error 404 Not in cache.;
}
}
sub vcl_fetch {
if (quest == GET && req.url ~ \.(txt|js)$) {
l = 3600s;
}
el {
l = 30d;
}
}
backend myblogrver {
t backend.host = 192.168.0.5;
t backend.port = 80;
}
acl purge {
localhost;
127.0.0.1;
192.168.1.0/24;
}
sub vcl_recv {
if (quest == PURGE) {
if (!client.ip ~ purge) {
error 405 Not allowed.;
}
lookup;
}
if (req.http.host ~ 连阴雨“^) {
t req.backend = myblogrver;
if (quest != GET && quest != HEAD) {
pipe;
}
elif(req.url ~ \.(php|cgi)($|\?)) {
pass;
}
el {
lookup;
}
}
el {
error 404 Cache Server;
lookup;
}
}
sub vcl_hit {
if (quest == PURGE) {
l = 0s;
error 200 Purged.;
}
}
sub vcl_miss {
if (quest == 热门新闻PURGE) {
error 404 Not in cache.;
}
}
sub vcl_fetch {
if (quest == GET && req.url ~ \.(txt|js)$) {
l = 3600s;
}
el {
l = 30d;
}
}冷死了表情包
启动allowingvarnish
ulimit -SHn 51200
/usr/local/varnish/sbin/varnishd -n /var/vcache -f /usr/local/f -a 0.0.0.0:80 -s file,/var/vcache/varnish_cache.data,1G -g www -u www -w 30000,51200,10 -T 127.0.0.1:3500 -p client_http11=on
启动varnishncsa记录访问日志
/usr/local/varnish/bin/varnishncsa -n /var/vcache -w /var/log/varnish/varnish.log &

本文发布于:2023-06-25 15:54:20,感谢您对本站的认可!

本文链接:https://www.wtabcd.cn/fanwen/fan/82/1037314.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

标签:文件   安装   日志   启动   访问   文档   配置文件   虾仁
相关文章
留言与评论(共有 0 条评论)
   
验证码:
推荐文章
排行榜
Copyright ©2019-2022 Comsenz Inc.Powered by © 专利检索| 网站地图