Skip to content

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

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

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions