Skip to content

Vhost editor rejects a site's own unmodified stored template with an empty error message #804

Open

Description

@vyrenlife-source

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

  1. Sites > (a PHP site) > Vhost
  2. Select the entire template shown in the editor, copy it
  3. Without changing anything, paste it back (replacing the content)
  4. 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

  1. cloudpanel-io commented on Sep 10, 2026

    @cloudpanel-io
    Owner

    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

  2. vyrenlife-source commented on Sep 10, 2026

    @vyrenlife-source
    Author

    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.

  3. cloudpanel-io commented on Sep 10, 2026

    @cloudpanel-io
    Owner

    The user clp executes the following command:

    /usr/bin/sudo /usr/sbin/nginx -t

  4. vyrenlife-source commented on Sep 17, 2026

    @vyrenlife-source
    Author

    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 is
    successful". The only output is three warnings on stderr:
    nginx: [warn] "ssl_stapling" ignored, no OCSP responder URL in the certificate "...".
    There is no include of snippets/custom.conf in the vhost (the file does not exist; the
    includes are the site's own two snippets, global_settings and fastcgi_params).
    So nginx -t passes for clp. Question: does the vhost editor treat any stderr output — such
    as these [warn] lines — as a failed test? That would explain why the editor rejects the
    site's own unmodified stored template while nginx -t itself succeeds.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions