Start, restart or stop Varnish

17.6k Views Asked by At

I am using this link for installing Varnish for nginx on CentOS 7.

How can I start, restart or stop Varnish?

3

There are 3 best solutions below

1
On

service varnish restart

Completely restarts Varnish, using the operating system mechanisms. Your cache will be flushed

service varnish reload

Only reloads VCL. Cache is not affected.

Apart from these service varnish start & service varnish stop can be used as general commands. Using these may effect your cache directly.

2
On

The post that you used for the base to install Varnish relies on installing from source. This should be avoided for many reasons:

  • Security. There is no easy way to update something installed from source. Packages are meant for easy updates instead.
  • Security again. You install development packages to compile. That's more software on the system, and more risk.
  • Usability. It does not ship with / does not install scripts to start, restart or stop Varnish

Save yourself time, and install Varnish using official RPM repository here.

curl -s https://packagecloud.io/install/repositories/varnishcache/varnish5/script.rpm.sh | sudo bash

After this you can start, restart and stop Varnish using standard OS routines, like service varnish restart.

It's quick and you will be running in no time!

0
On

Use "systemctl start/restart/stop varnish".