New in CWP Edge-LatestFree with every CWPpro licenceWebsites up to 300x faster

CWP now includes LSPHP, LSAPI-Cache and CWP Cage at no extra cost with all CWPpro licences. The LSAPI-Cache plugin is integrated into our WordPress and other script installers, and CWP Cage gives every user complete isolation. Available now in the CWP Edge-Latest version.

Get CWPpro ›

Varnish 7 Installation & Configuration

Started by SteveRD, April 09, 2025, 02:21:25 PM

Previous topic - Next topic

SteveRD

Has anyone successfully installed Varnish 7 on CWP yet?

I've tried a couple of times now but still get 503 when testing. Has anyone figured out the correct changes for the varnish.service file?

Netino

Quote from: SteveRD on April 09, 2025, 02:21:25 PM
Has anyone successfully installed Varnish 7 on CWP yet?

I've tried a couple of times now but still get 503 when testing. Has anyone figured out the correct changes for the varnish.service file?

Yes.
You already install it?

After install, you need to change the line in file '/usr/lib/systemd/system/varnish.service' of default installation, from:
ExecStart=/usr/sbin/varnishd -a :6081 -f /etc/varnish/default.vcl -s malloc,256m

to:
ExecStart=/usr/sbin/varnishd -a :82 -f /etc/varnish/default.vcl -s malloc,256m

After that, run:
# systemctl daemon-reload

SteveRD

Ok fantastic. I'll give it another go tonight.

Thanks for taking the time to explain it. I was going crazy.

SS

SteveRD

Quote from: Netino on April 10, 2025, 01:18:09 AM
Quote from: SteveRD on April 09, 2025, 02:21:25 PM
Has anyone successfully installed Varnish 7 on CWP yet?

I've tried a couple of times now but still get 503 when testing. Has anyone figured out the correct changes for the varnish.service file?

Yes.
You already install it?

After install, you need to change the line in file '/usr/lib/systemd/system/varnish.service' of default installation, from:
ExecStart=/usr/sbin/varnishd -a :6081 -f /etc/varnish/default.vcl -s malloc,256m

to:
ExecStart=/usr/sbin/varnishd -a :82 -f /etc/varnish/default.vcl -s malloc,256m

After that, run:
# systemctl daemon-reload


I ended up getting it running but at least in v7.7 it's slightly different

Here is the original varnish.service file

ExecStart=/usr/sbin/varnishd \
          -a :6081 \
          -a localhost:8443,PROXY \
          -f /etc/varnish/default.vcl \
          -P %t/%N/varnishd.pid \
          -p feature=+http2 \
          -s malloc,256m


it seems if you change it as below it works (changing the port to 82 and proxy port to 8444 - conflicts with httpd on 8443)

ExecStart=/usr/sbin/varnishd \
          -a :82 \
          -a localhost:8444,PROXY \
          -f /etc/varnish/default.vcl \
          -P %t/%N/varnishd.pid \
          -p feature=+http2 \
          -s malloc,256m



then run



systemctl daemon-reload
systemctl enable varnish
systemctl status varnish


After confirmed running you need to go to CWP and rebuild the webservers in CWP in order to generate the conf files.

Thanks again to Netino for pointing this out!