How to Install Varnish Cache in Front of Apache (AlmaLinux, Rocky Linux and Ubuntu)
Install Varnish from your distribution's packages (dnf install varnish or apt install varnish), move Apache to port 8080, point Varnish's backend at 127.0.0.1:8080 in /etc/varnish/default.vcl, and make Varnish listen on port 80. Varnish does not handle HTTPS, so put Nginx or Hitch in front of it on port 443. Test with curl -I and look for the X-Varnish and Age headers. On cPanel servers, use NGINX Manager in WHM instead.