<< All Posts
Enabling GZIP Compression to Varnish

How to enable GZIP compression on httpd (OpenBSD) and Varnish?

If you want to learn how to install Varnish Cache on OpenBSD, please click here.

When I wrote the post teaching how to install Varnish I didn’t set any special configuration (oh well) actually I didn’t set any configuration.

Well, let’s add our first useful configuration. Since it’s not possible to add GZIP support on default OpenBSD’s webserver (httpd) we can add it using Varnish.

Edit your /etc/varnish/builtin.vcl:

vim /etc/varnish/builtin.vcl

sub vcl_backend_response {
    # Enabling GZIP
    if (beresp.http.content-type ~ "text") {
        set beresp.do_gzip = true;

That’s it. It will add gzip compression on all html, css pages served by your server.

Now, we need to restart Varnish. On a Debian like Operational System, you can just type:

service varnish restart

Well, using OpenBSD it’s a little different:

cd /etc/rc.d

sudo ./varnishd stop

sudo varnishd -f /etc/varnish/builtin.vcl

I hope you enjoyed!


<< All Posts


🇧🇷 🇨🇦
Runs on OpenBSD 🐡