Skip to content

Setup Contao

Setup Contao

This example installs Contao 5 with Composer inside the Devilbox PHP container. It preserves the classic Devilbox virtual host layout while updating the runtime to PHP 8.3 or newer.

Overview

Project nameContainer pathDatabaseTLD_SUFFIXProject URL
my-contao/shared/httpd/my-contaomy_contaolvh.mehttp://my-contao.lvh.me / https://my-contao.lvh.me

Inside the PHP container, projects are always under /shared/httpd/. On the host they are stored below ./data/www/ in the Devilbox checkout.

Required configuration

ServiceVersionNotes
WebserverApache 2.4 or NginxApache works with Contao’s default routing rules; Nginx may need a custom vhost template.
PHPPHP 8.3+env-example includes PHP 8.3 and PHP 8.4 containers.
DatabaseMySQL or MariaDBUse the bundled MySQL service for this example.

Start Devilbox:

Terminal window
./dvl.sh up php httpd mysql bind

Walk through

It will be ready in seven steps:

  1. Enter the PHP container.
  2. Create a new virtual host directory.
  3. Install Contao 5 with Composer.
  4. Link public/ to htdocs.
  5. Add the MySQL database.
  6. Verify DNS.
  7. Open the Contao installer.

1. Enter the PHP container

Terminal window
./dvl.sh shell php83

2. Create the vhost directory

Terminal window
mkdir -p /shared/httpd/my-contao
cd /shared/httpd/my-contao

3. Install Contao 5

Terminal window
composer create-project contao/managed-edition:^5.0 contao

Expected structure:

Terminal window
tree -L 1
.
└── contao

Contao 5 serves from public/:

Terminal window
ln -s contao/public htdocs

Expected structure:

Terminal window
tree -L 1
.
├── contao
└── htdocs -> contao/public

5. Add the MySQL database

Terminal window
mysql -u root -h mysql -p -e 'CREATE DATABASE my_contao CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;'

Use the MySQL root password from .env if one is configured.

6. Verify DNS

my-contao.lvh.me resolves to 127.0.0.1 by default. For a custom suffix, add an equivalent hosts entry.

7. Open the installer

Visit http://my-contao.lvh.me/contao/install or https://my-contao.lvh.me/contao/install and follow the web installer.

Use these database values:

  • Database host: mysql
  • Database port: 3306
  • Database user: root
  • Database name: my_contao

Installation flow

The Contao installer guides you through accepting the license, setting the install-tool password, connecting the database, updating schema tables, and creating an admin user. After that, use /contao to log in to the back end.

Next steps

  • Use Adminer or phpMyAdmin from the Devilbox intranet for database checks.
  • Add a custom Nginx vhost only if you use Nginx and routing does not work.
  • Configure trusted local HTTPS before sharing browser screenshots or demos.