# On-disk layout

> Where Berth keeps websites, logs, mail and configuration: the Plesk-compatible paths under /var/www/vhosts and /var/qmail/mailnames, the users and groups with their uids and gids, the Dovecot folder namespace, and the rendered configuration under /etc/berth.

Source: https://www.berthpanel.app/library/on-disk-layout/ · Category: concepts · Updated: 2026-10-30

Berth uses the same directory layout as Plesk. That is deliberate: a server migrated from Plesk keeps its data in the place it already had, scripts and backups that know Plesk paths keep working, and administrators who know Plesk find their way at once. This article lists where everything lives and who owns it.

## Overview

| Path | What |
|---|---|
| `/var/www/vhosts/<domain>` | Webspace of a subscription (home directory of its system user) |
| `/var/www/vhosts/<domain>/httpdocs` | Default document root |
| `/var/www/vhosts/system/<domain>/logs` | Web server and PHP logs per domain |
| `/var/qmail/mailnames/<domain>/<mailbox>/Maildir` | Mail, one Maildir per mailbox |
| `/etc/berth` | Panel settings, certificates, DKIM keys, licence, installation choices |
| `/etc/berth/rendered` | Configuration rendered by Berth, one directory per service |
| `/etc/berth/local` | Your own additions to service configuration |
| `/var/lib/berth/backups` | Local backup archives per subscription |
| MariaDB schema `berth` | The panel database |

## Webspaces under /var/www/vhosts

Each subscription has a system user whose home is its webspace, `/var/www/vhosts/<domain>`, named after the subscription's first domain. Inside:

| Path | Owner | Mode | Purpose |
|---|---|---|---|
| `/var/www/vhosts/<domain>` | `root:psaserv` | `0750` | The webspace itself. Owned by root because SFTP chroots into it; the web server reaches it through the `psaserv` group. |
| `httpdocs/` | `<sysuser>:psacln` | `0750` | Document root of the site. |
| `httpdocs/error_docs/` | the subscription | | Custom error pages (403, 404, 500, 50x), used when enabled for the domain. |
| `tmp/` | `<sysuser>:psacln` | `0750` | PHP upload directory and session storage, and `/tmp` and `/var/tmp` of the subscription's PHP-FPM, apps and shell (counts towards the disk quota). |

Details worth knowing:

- **Custom document roots** are supported, for example `httpdocs/public` for Laravel. Root creates only the first directory under the webspace; deeper directories are created as the subscription user, so a symbolic link placed by a customer can never redirect a root operation.
- **Several domains in one webspace**: a domain can have its own webspace, or share the webspace of another domain in the same subscription with its own document root. Migrated accounts keep their source layout, for example `domains/<domain>/public_html` from DirectAdmin.
- **Other subscriptions cannot read a webspace**: they are in the `psacln` group, which has no access to the webspace root.

## Logs under /var/www/vhosts/system

Per domain, logs are in `/var/www/vhosts/system/<domain>/logs`, as in Plesk:

| File | Content |
|---|---|
| `proxy_access_log`, `proxy_access_ssl_log` | nginx access logs (http and https) |
| `proxy_error_log` | nginx errors |
| `access_log`, `error_log` | Apache |
| `php_error_log`, `php_slow_log` | PHP errors and slow requests |
| `modsec_audit.log` | WAF events for the domain |

The log directory belongs to root and is readable by the web server and, through an ACL, by the subscription's own user, not by other subscriptions: logs contain visitor addresses and sometimes URLs with tokens. Root ownership also stops a customer process from planting a symbolic link that the web server would follow as root. Customers search their own logs under *Statistics → Logs*. See [Logs and log drains](https://www.berthpanel.app/library/logs-and-log-drains/).

## Users and groups

| Account | Default id | Purpose |
|---|---|---|
| group `psacln` | gid 1001 | All subscription users (the customers' group) |
| group `psaserv` | gid 1002 | The web servers (nginx, Apache), which need to enter webspaces |
| user and group `popuser` | uid 30, gid 31 | Owner of all Maildirs; Dovecot and delivery run mail as this user |
| user `berth` | system account | The unprivileged panel daemon `berthd` |
| one user per subscription | assigned at creation, never reused | Runs everything of that subscription: PHP, apps, cron, SFTP, shell, containers |

If gid 1001 or 1002 is already taken (a cloud image often has a group `ubuntu` on 1001), the installer picks the first free id above it.

### Keeping ids from a migration source

When you migrate a server, the new server should use the **same uids and gids** as the old one, so file ownership in copied data, archives and NFS mounts stays correct. Set them at installation, with the numbers from the source server:

```bash
berth install --psacln-gid <gid> --psaserv-gid <gid> --popuser-uid <uid> --popuser-gid <gid>
```

Subscription users are created with the same name and uid as on the source. An id that is already in use on the new server gives a clear error instead of a silent mismatch. See [Migrating a server](https://www.berthpanel.app/library/migrate-a-server/).

## Mail under /var/qmail/mailnames

Each mailbox is a Maildir at `/var/qmail/mailnames/<domain>/<mailbox>/Maildir`, owned by `popuser`, exactly as on Plesk. Dovecot is configured to match:

- **Namespace** `INBOX.` with separator `.`, so a folder is `INBOX.Archive` and a subfolder `INBOX.Archive.2026`. Mail clients that were set up against Plesk see the same folder names.
- **Folder names in UTF-8 on disk**, as Plesk writes them, so folders with accents or an ampersand migrated from Plesk open normally.
- **Special folders** *Drafts*, *Sent*, *Trash* and *Junk* are created and subscribed automatically, with their IMAP special-use flags.
- **UIDs are preserved** on migration: the `dovecot-uidlist` with its UIDVALIDITY is copied along, so mail clients do not download every message again after the move.

Mailbox passwords are stored as SHA512-CRYPT; hashes migrated from the source keep working. Autoresponder, forwarding and spam filter rules are Sieve scripts kept next to the Maildir and rendered from the panel database. See [Mailboxes](https://www.berthpanel.app/library/mailboxes/).

## /etc/berth

`/etc/berth` holds everything that makes the server *this* server: settings, certificates, DKIM keys, the licence, the choices of the installation (used by `berth install --reconfigure` and package upgrades) and the server policy in `beleid.d`. It is part of every server-settings backup and of [disaster recovery](https://www.berthpanel.app/library/disaster-recovery/).

### /etc/berth/rendered

Berth renders the configuration of each service into its own directory here:

```text
/etc/berth/rendered/
  nginx/vhosts/<domain>.conf
  apache/vhosts/<domain>.conf
  php-fpm-8.3/pools/...           one directory per PHP version
  postfix/                        maps for domains, mailboxes, aliases, limits
  dovecot/
  opendkim/
  proftpd/
  berth-waf/
  webmail/
  ...
```

Each service's own configuration contains only a small include file that points into this tree, so the configuration shipped by the distribution stays in place. Files are always rendered whole from the panel database, tested and swapped in atomically; see [How changes go live](https://www.berthpanel.app/library/how-changes-go-live/). Do not edit files here by hand: the next apply or `berth repair --areas config` writes them again from the database.

A file that the configuration test singled out as broken gets a `.berth-quarantine` suffix, which the includes do not read; its content stays for inspection.

### /etc/berth/local

Your own additions for nginx, Apache, Postfix and Dovecot go in `/etc/berth/local/`, which the services include but Berth never overwrites. Template fragments for the hoster live in `/etc/berth/local/sjablonen/`; see [How changes go live](https://www.berthpanel.app/library/how-changes-go-live/#customising-safely) and [template fragments](https://www.berthpanel.app/library/web-server-settings/#template-fragments). Both are kept in server-settings backups.

You can also edit these additions in the panel, under *System → Configuration* (`berth system local-config`). There is one managed addition per service: nginx, Apache, PHP-FPM per version, Postfix, Dovecot, MariaDB, sysctl, journald and logrotate. Directives that would run code as root or touch files that do not belong to the service are refused. Each change runs through the service's own configuration test, and after a minute Berth checks that the service still runs and answers; unless you confirm the change within a few minutes, the previous content goes back automatically. Every version is kept and can be applied again, and an edit made by hand on disk can be adopted as the managed addition.

```bash
berth system local-config list
berth system local-config check nginx --file extra.conf      # forbidden directives and the diff, nothing written
berth system local-config apply nginx --file extra.conf --note "longer timeout"
berth system local-config confirm nginx
berth system local-config adopt postfix                      # take over a hand edit
berth system local-config apply-version nginx 3
```

## Programs

| Installed with | Programs |
|---|---|
| The one-line command or a release directory | `/usr/local/sbin/berth`, `berthd`, `berth-agent`, `berth-probe` |
| deb or rpm package | `/usr/lib/berth/`, with `berth` in `/usr/sbin` |

The systemd units `berth-agent.service` and `berthd.service` start them.

## Backups and other data

- **Local archives** per subscription: `/var/lib/berth/backups`. By default the last 7 nightly archives stay on the server.
- **The hourly history** is a deduplicated restic repository per subscription on the same server.
- **Container storage** (images, layers, volumes) is kept per subscription, outside the webspace, and counts toward the subscription's disk quota.

See [Backups overview](https://www.berthpanel.app/library/backups-overview/).

## What Berth does not touch

`berth uninstall` removes the panel's programs, units, includes and rendered configuration, and puts back the original configuration of each service. It never removes customer data: `/var/www/vhosts`, the Maildirs, customer databases and backups stay. Only `--purge` also removes the panel database and `/etc/berth`.
