Setup Drupal
Setup Drupal
This example installs Drupal 10 or 11 with Composer inside the Devilbox PHP container. The modern Drupal project template places the web entrypoint in web/, which is linked to Devilbox’s htdocs directory.
Overview
| Project name | Container path | Database | TLD_SUFFIX | Project URL |
|---|---|---|---|---|
my-drupal | /shared/httpd/my-drupal | my_drupal | lvh.me | http://my-drupal.lvh.me / https://my-drupal.lvh.me |
Inside the container, projects are stored in /shared/httpd/; on the host, use ./data/www/.
Prerequisites
- Devilbox with PHP 8.3+ and Composer.
- MySQL, HTTPD, and Bind services.
- Docker Compose v2 via Docker.
Start the stack:
./dvl.sh up php httpd mysql bindWalk through
It will be ready in seven steps:
- Enter the PHP container.
- Create a new virtual host directory.
- Install Drupal with Composer.
- Link
web/tohtdocs. - Add a MySQL database.
- Verify DNS.
- Open the Drupal installer.
1. Enter the PHP container
./dvl.sh shell php832. Create the vhost directory
mkdir -p /shared/httpd/my-drupalcd /shared/httpd/my-drupal3. Install Drupal
For Drupal 10 LTS-style compatibility:
composer create-project drupal/recommended-project:^10 drupalFor a new Drupal 11 project on PHP 8.3+:
composer create-project drupal/recommended-project:^11 drupalExpected structure:
tree -L 1.└── drupal4. Link the webroot
ln -s drupal/web htdocsExpected structure:
tree -L 1.├── drupal└── htdocs -> drupal/web5. Add the MySQL database
mysql -u root -h 127.0.0.1 -p -e 'CREATE DATABASE my_drupal CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;'6. Verify DNS
my-drupal.lvh.me resolves to 127.0.0.1. For a custom suffix, add an equivalent hosts-file record.
7. Open the Drupal installer
Visit http://my-drupal.lvh.me or https://my-drupal.lvh.me and follow the installer.
Use these database values:
- Database type:
MySQL, MariaDB, Percona Server, or equivalent - Database name:
my_drupal - Database username:
root - Database password: your
.envvalue - Advanced host:
127.0.0.1
Next steps
- Install Drush per project with
composer require drush/drushwhen needed. - Use
./dvl.sh exec "vendor/bin/drush status"from the Drupal project directory for non-interactive checks. - Configure HTTPS and Xdebug after the installer completes.