billingHelp

From a bare Ubuntu server to a running installation

Packages, directories and permissions, the database, Nginx, TLS with certbot, the installer, and the first checks.

This guide assumes Ubuntu 24.04, a domain pointing at the server (here encrypted.com) and a user with sudo. The layout:

/var/www/encrypted.com/public/   webroot (Nginx root)
/var/www/encrypted.com/app/      PHP source, never served
/var/www/encrypted.com/data/     config, keys, logs, backups, uploads, geo, cache

1. Install the packages#

sudo apt update && sudo apt -y upgrade
sudo add-apt-repository -y ppa:ondrej/php        # PHP 8.4 on 24.04 (8.2+ works; the self-check warns below 8.4)
sudo apt install -y nginx mariadb-server \
  php8.4-fpm php8.4-cli php8.4-mysql php8.4-curl php8.4-mbstring php8.4-gd php8.4-xml php8.4-intl
sudo timedatectl set-ntp true                    # providers reject webhooks signed with a wrong clock

sodium, openssl, json and zlib are part of the Ubuntu PHP packages. No Composer and no other PHP or JavaScript library is needed.

2. Secure MariaDB#

sudo mariadb-secure-installation   # set a root password, remove anonymous users and the test database

The installer creates the application's database and its three users itself; it only needs the root login once.

3. Copy the files and set permissions#

sudo mkdir -p /var/www/encrypted.com/data
sudo cp -r public app docs /var/www/encrypted.com/
sudo chown -R root:root /var/www/encrypted.com
sudo chown www-data:www-data /var/www/encrypted.com/data       # only data/ is writable by PHP
cd /var/www/encrypted.com/public
sudo chown www-data:www-data robots.txt site.webmanifest
sudo touch sitemap.xml llms.txt llms-full.txt && sudo chown www-data:www-data sitemap.xml llms.txt llms-full.txt

The last two lines let the hourly seo.publish job keep the five SEO files current while the rest of the webroot stays read-only.

4. Configure Nginx#

The application needs no rewrite rules, so either vhost from docs/ works:

  • docs/nginx-hardened.conf — recommended: TLS, clean URLs (try_files … /index.php), long cache for assets, denies dotfiles and helper files.
  • docs/nginx-plain.conf — the minimum; links then look like /admin/?r=settings/users.
sudo cp /var/www/encrypted.com/docs/nginx-hardened.conf /etc/nginx/sites-available/encrypted.com
sudo ln -s /etc/nginx/sites-available/encrypted.com /etc/nginx/sites-enabled/
sudo rm -f /etc/nginx/sites-enabled/default

Check the PHP-FPM socket in the file (php8.4-fpm.sock) matches your PHP version.

5. Get a TLS certificate#

sudo apt install -y certbot python3-certbot-nginx
sudo certbot certonly --nginx -d encrypted.com     # paths in the hardened vhost match certbot's defaults
sudo nginx -t && sudo systemctl reload nginx

certbot renews the certificate automatically. The system monitor warns when the certificate is close to expiry.

6. Run the installer#

cd /var/www/encrypted.com
sudo -u www-data php app/cli.php install \
  --base-url=https://encrypted.com \
  --db-name=billing --db-root-user=root --db-root-pass='…' \
  [email protected] --super-name='Your Name'

The installer checks PHP, refuses app/ or data/ inside the webroot, creates the database and its three users, generates data/keys/master.key and prints it once, applies the migrations, creates your super-admin account and writes data/config.php last.

A web installer exists too (/install.php), protected by a one-time code that you write to app/install.allow from the shell. Delete public/install.php after installation.

7. Check the installation#

sudo -u www-data php app/cli.php selfcheck     # exit code 1 if anything fails
curl -s https://encrypted.com/health           # {"status":"ok",…}

Sign in at https://encrypted.com/super/login, then continue with the scheduler and monitoring, email and your first workspace (Workspaces).