How to configure varnish cache for a domain in Plesk?

Follow

Comments

9 comments

  • Avatar
    Guido Wiedner

    Are the instructions still up to date?
    I tried to install varnish 7.1.2.
    docker status shows the message: is assigned with an IP address 172.17.0.0/16
    I've changed that accordingly. But the container does not start.
    Error: Could not get socket :80: Permission denied (-? gives usage).
    I can't find any /etc/varnish/default.vcl either
    -bash: cd: /etc/varnish: No such file or directory
    Under the domain in Add Docker Proxy Rules, there is also no entry under Port
    I appreciate any help.
    Thanks very much

    0
    Comment actions Permalink
  • Avatar
    Stefan Yakubov

    Yes, please follow the instructions using the stable docker version specified in there.

    0
    Comment actions Permalink
  • Avatar
    Stefan Braunersreuther (Edited )

    Until yesterday we had a great running Varnish Cache in Docker, thanks for the great tutorial. Tonight an update made our Varnish cache unusable. The beautiful error message 503 appears.
    The following packages were successfully updated:
    - containerd.io 1.6.24-3.1.el8 from the plesk-ext-docker repository (previous version: 1.6.22-3.1.el8 from the plesk-ext-docker repository).

    Update: After a second server restart and a reinstallation of Varnish, the error was gone.

    Greetings
    Stefan

    0
    Comment actions Permalink
  • Avatar
    Stefan Yakubov

    Hello, Stefan Braunersreuther

    By the looks of it, the application itself was rather down or misconfigured within the container. Next time this happens, you can enter the container via docker CLI and have a look at the varnish status.

    E.g., is it running/listening on the ports.

    0
    Comment actions Permalink
  • Avatar
    Bragi Austson

    Varnish Cache works really well for wordpress but for other CMS systems like Joomla 5 - 4 is not working at all.

    In CWP the Varnish Cache works like a charm

    0
    Comment actions Permalink
  • Avatar
    Stefan Yakubov

    Hi, Bragi.

    Yes that is expected, Joomla will require a different varnish configuration. For instance, you can review the following gists and adjust one for your needs:

    https://gist.github.com/fevangelou/84d2ce05896cab5f730a

    0
    Comment actions Permalink
  • Avatar
    Kev Quirk

    This seems to be working well for me, but I have a control panel on my site at /panel. Normally I would just add the following to my default.vcf:

    sub vcl_recv {
        if (req.url ~ "^/panel($|/.*)") {
            return (pass);
        }
    }

    But I can't find a way to that with Docker on Plesk. How would I do it?

    0
    Comment actions Permalink
  • Avatar
    Christos Tziotzis

    Do we need to have multiple varnish containers for each domain we decide to proxy through varnish?

    I'm concerned about the memory usage

    0
    Comment actions Permalink
  • Avatar
    Stefan Yakubov

    Hello, Christos Tziotzis

    One container per IP Address. The number of domains doesn't matter as long as they use the IP Address specified in the varnish conf file inside of a container

    0
    Comment actions Permalink

Please sign in to leave a comment.

Have more questions? Submit a request