Repository navigation
Description
CloudPanel version(s) affected
2.5.4
Description
Summary
The Sites > (site) > Vhost editor refuses to save with
Vhost is not valid, error message:
and the error message placeholder is empty. No reason is shown.
This reproduces with the site's own, unmodified, currently stored
template: copy what the editor displays, paste it back unchanged,
press Save. It is rejected.
The rendered configuration is valid: nginx -t on the generated vhost
returns test is successful.
Environment
| CloudPanel | 2.5.4 (CLI 6.0.8) |
| OS | Ubuntu 26.04 LTS |
| nginx | 1.30.4 |
| PHP | 8.4.24 |
| Site type | PHP |
What I measured
1. The stored template is clean. Read directly from
/home/clp/htdocs/app/data/db.sq3, field site.vhost_template, at byte
level:
length 2368 bytes, 106 lines
contains \r 0
contains non-ASCII 0
2. nginx accepts the rendered result. I wrote the rendered template
to the live vhost path and ran nginx -t:
nginx: configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
3. The save sequence is visible in syslog, and the failure is not.
Two attempts, both identical:
sudo[...]: clp : COMMAND=/usr/bin/cp /etc/nginx/sites-enabled/<site>.conf /etc/nginx/sites-enabled/<site>.conf.bak
sudo[...]: clp : COMMAND=/usr/bin/cp /etc/nginx/sites-enabled/<site>.conf.bak /etc/nginx/sites-enabled/<site>.conf
sudo[...]: clp : COMMAND=/usr/bin/bash -c /bin/rm -f '/etc/nginx/sites-enabled/<site>.conf.bak'
Backup, write, restore, cleanup. The validation step itself
leaves no trace, presumably because it runs as root directly rather
than through sudo.
4. Nothing is logged anywhere.
/var/log/clp-agent/agent.log 0 bytes
/home/clp/logs/nginx/error.log 0 bytes
/home/clp/logs/php/error.log last entry 10 days old (FPM startup only)
journalctl -u clp-agent no entries
Why the empty message matters more than the rejection
A rejection with a reason is a normal guard rail. A rejection with an
empty reason gives the operator nothing to act on, and the
validation step writes no log, so there is no second place to look.
In my case I only established that my own change was not the cause
by pasting the unmodified template and seeing it rejected too.
What I was trying to do
Add a single include line to the template so a set of hand-maintained
location blocks survives vhost regeneration:
{{settings}}
include /etc/nginx/snippets/custom.conf;The documentation describes syntax checking, rollback and an error
message, but says nothing about restrictions on include. I could not
find an existing issue with this symptom.
include is already used inside the default template
(include /etc/nginx/global_settings;), so the directive itself does
not appear to be rejected, and in any case the unmodified template is
rejected as well, so the include line is not the trigger.
Suggested fix
Surface the validator's actual error, or log it. If the check is
intentional, the message is what makes it usable.
How to reproduce
- Sites > (a PHP site) > Vhost
- Select the entire template shown in the editor, copy it
- Without changing anything, paste it back (replacing the content)
- Press Save
Expected: saved, or rejected with a reason.
Actual: Vhost is not valid, error message: with an empty reason.
Possible Solution
No response
Additional Context
No response
Activity
cloudpanel-io commentedon Sep 10, 2026
Hi @vyrenlife-source
an include shouldn't be a problem. Under the hood, we are checking if "nginx -t" returns any problem and if not, we save the vhost.
Did you check if the permissions on the directory and the include files are correct?
/etc/nginx/snippets/custom.conf
vyrenlife-source commentedon Sep 10, 2026
Thanks. To be precise about what I checked: /etc/nginx/snippets/custom.conf doesn't exist in my setup at all, I only referenced it as the include target I was trying to add, so it may not match how your test setups are laid out.
On permissions, one thing I hadn't checked before and now have: /etc/nginx itself is 0700 root:root. That blocks the clp user from traversing into it at all (sudo -u clp test -x /etc/nginx fails), including read access to the site's own vhost include files under sites-enabled/. /etc/nginx/snippets itself is 0775, so it's open, but its parent isn't.
I don't want to overclaim here though. Whether this matters depends on which process actually performs the vhost validation. If it runs as clp (the UI process), this permission chain would block it. If it runs as root (e.g. via clp-agent), it wouldn't be affected, and permissions still don't explain the empty-error rejection, since that also happens on the unmodified stored template, not tied to any include path.
Can you confirm which user/process runs the nginx -t validation on save? That would settle whether this permission chain matters. Either way the original ask stands: the validator's actual error, or a log of it, isn't surfaced anywhere.
cloudpanel-io commentedon Sep 10, 2026
The user clp executes the following command:
/usr/bin/sudo /usr/sbin/nginx -tvyrenlife-source commentedon Sep 17, 2026
Measured on the server as the clp user, exactly the command you named:
sudo -u clp /usr/bin/sudo /usr/sbin/nginx -t-> exit code 0, "syntax is ok", "test issuccessful". The only output is three warnings on stderr:
nginx: [warn] "ssl_stapling" ignored, no OCSP responder URL in the certificate "...".There is no
includeofsnippets/custom.confin the vhost (the file does not exist; theincludes are the site's own two snippets,
global_settingsandfastcgi_params).So
nginx -tpasses for clp. Question: does the vhost editor treat any stderr output — suchas these
[warn]lines — as a failed test? That would explain why the editor rejects thesite's own unmodified stored template while
nginx -titself succeeds.