Source: https://foxhop.net/f3b10d0f-2f95-11f1-b9f1-e86a64d24d78/implementing-varnish-cache
Snapshot: 2026-05-25T00:28:31Z
Generator: Remarkbox 1527ef7

This is a thread snapshot. The living document lives at the source URI above — it may have been edited, extended, or replied-to since.

Scan for living source

Implementing Varnish Cache

Install varnish

sudo apt-get install varnish

Make varnish listen to port 80

Also disable the varnish admin port

sudo cp -p /etc/default/varnish /etc/default/varnish.ORIG 
sudo vim /etc/default/varnish

diff /etc/default/varnish /etc/default/varnish.ORIG
40c40,41
< DAEMON_OPTS="-a :80 \
---
> DAEMON_OPTS="-a :6081 \
>              -T localhost:6082 \

Make Apache2 vhosts listen to port 8080

cp -p /etc/apache2/ports.conf /etc/apache2/ports.conf.ORIG
sudo vim /etc/apache2/ports.conf
diff /etc/apache2/ports.conf /etc/apache2/ports.conf.ORIG
8c8
< NameVirtualHost *:8080
---
> NameVirtualHost *:80
10c10
< Listen 8080
---
> Listen 80

Now edit all the vhost files with two commands:

cd /etc/apache2/sites-available
sudo perl -pi -w -e 's/\:80/\:8080/g;' *

The above command performs a search and replace on every file in the directory changing :80 to :8080

Restart Daemons

sudo service apache2 restart
sudo service varnish restart

Source: https://foxhop.net/f3b10d0f-2f95-11f1-b9f1-e86a64d24d78/implementing-varnish-cache
Snapshot: 2026-05-25T00:28:31Z
Generator: Remarkbox 1527ef7