---
title: "varnish 缓存到硬盘"
author: "ol_beta"
date: "2012-09-19T18:27:58Z"
tags: []
categories: ["开源软件"]
slug: "varnish"
draft: false
lastmod: "2012-09-19T18:28:58Z"
id: 1681716
url: "https://softbeta.iteye.com/blog/1681716"
---

方法一：在启动的时候设置

 

```
varnishd -s file,/var/lib/varnish/varnish_storage.bin,50%
```

 

方法二：修改默认启动文件

 

 

```
 vi /etc/default/varnish

DAEMON_OPTS="-a :9350 \
             -T localhost:9351 \
             -f /etc/varnish/default.vcl \
             -S /etc/varnish/secret \
                 -s file,/mnt/varnish/varnish_storage.bin,200G"
```

 

参考：[http://nwlinux.com/varnish-file-storage-malloc-or-file/](http://nwlinux.com/varnish-file-storage-malloc-or-file/)