Posts tagged varnish 3

Varnish 3 – Block ip addresses

3

To block ip addresses with Varnish edit the following file:

sudo nano /etc/varnish/default.vcl

And add the following. Of course replace the example ip addresses with the real ips you want to block.

acl forbidden {     "111.11.111.111";     "123.12.123.123";     "456.123.12.72"; } sub vcl_recv {     # Block access from these ips     if (client.ip ~ forbidden) {         error 403 "Forbidden";     } }

After editing, execute:

sudo service varnish restart

Ubuntu 12.04 – Install Varnish 3 in front of Apache 2

5

Step 1: Install latest version of Varnish (3.0)

These first three lines are probably not required on Ubuntu 12.04 because the main repository already contains version 3, but you can use it anyhow. Older version of Ubuntu do need it though!

curl http://repo.varnish-cache.org/debian/GPG-key.txt | sudo apt-key add -
echo "deb http://repo.varnish-cache.org/ubuntu/ lucid varnish-3.0" | sudo tee -a /etc/apt/sources.list
sudo apt-get update
sudo apt-get install varnish

Step 2: Set backend server (Apache)

Edit the varnish configuration file.

sudo nano /etc/varnish/default.vcl

Set the backend server. The lines below say that the backend server (Apache) is available More >

Go to Top