How to implent gzip on Caddy


(Anggi Adi Putra) #1

3 days ago I have install caddy on my VPS, how to using gzip on caddy?


(Matthew Fay) #2

Hi @anggiadiputra, welcome to the Caddy community!

Have you tried adding gzip to your Caddyfile?

https://caddyserver.com/docs/gzip


(Anggi Adi Putra) #3

only this
gzip {
level 8
min_length 1
}


(Matthew Fay) #4

Looks good to me!


(Anggi Adi Putra) #5

there a better configuration for my wordpress?


(Matthew Fay) #6

A higher compression level is slower. The default is a better mix of compression and speed for mixed content. I’d probably just use gzip on its own, without overriding the defaults.


(Anggi Adi Putra) #7

ok.
How to set up expired header ?


(Matthew Fay) #8

You can set headers with the header directive.

https://caddyserver.com/docs/header

You could also download Caddy with the optional expires plugin and use that instead of manually setting the header.

https://caddyserver.com/docs/http.expires


(Anggi Adi Putra) #9

thanks sir