Hello, I recently installed CWP on AlmaLinux 9 (
https://dl1.centos-webpanel.com/files/cwp-el9-latest) and to my surprise, when I go to WebServers_manage and select Nginx & Varnish & Apache, Varnish NEVER installs. By analyzing cwpsrv with stress-ng, I was able to detect exactly where the error is.
The strace accurately reveals why the installer was failing silently:
The panel tries to download a non-existent script (varnish.sh returns a 404 at
https://dl1.centos-webpanel.com/files/s_scripts/el9/varnish.sh).
Then, it tries to apply a sed command to /etc/varnish/varnish.params. This throws an "Exit Code 2" because Varnish no longer uses that file in AlmaLinux 9.
Finally, it crashes when trying to clean /etc/varnish/conf.d/vhosts because the directory simply does not exist.
In the end, PHP generates the .vcl files, but the daemon is never actually installed or started.
The following EL8 script logic was used as a reference to build the fix:
https://dl1.centos-webpanel.com/files/s_scripts/el8/varnish.sh# 1. Install repositories and clean dependencies
dnf -y install epel-release jemalloc --enablerepo=epel
curl -s https://packagecloud.io/install/repositories/varnishcache/varnish64/script.rpm.sh | bash
dnf -y module disable varnish
dnf -y install varnish
# 2. Build the directory structure that the panel assumes exists
mkdir -p /etc/varnish/conf.d/vhosts
touch /etc/varnish/conf.d/vhosts.conf
# 3. Patch the CWP bug (The phantom file)
# We create this file to prevent the panel's internal "sed" from throwing Exit Code 2
echo "VARNISH_LISTEN_PORT=82" > /etc/varnish/varnish.params
# 4. Modify the master port at the Systemd level (The definitive way)
if [ -e "/usr/lib/systemd/system/varnish.service" ]; then
sed -i "s|6081|82|g" /usr/lib/systemd/system/varnish.service
systemctl daemon-reload
fi
# 5. Force PHP to regenerate the vHosts with the repaired structure
sh /scripts/cwpsrv_rebuild_user_conf
# 6. Bring up the proxy chain in order
systemctl enable --now varnish
systemctl restart httpd
systemctl restart varnish
systemctl restart nginxI hope they update WebServers_manage