---
title: Example: WordPress
slug: hosty/example-wordpress
icon: {"faIcon":"fa-brands fa-wordpress-simple"}
createdAt: 2026-11-08T11:27:49.007Z
---

A WordPress site built with Composer, with its web root in `web`, in the `wordpress` folder of the project, served by Apache. See [Project configuration](https://wiki.systemseed.com/hosty/project-configuration) for all settings.

```yaml
clusterName: <cluster>
clusterRegion: eu-west-2
projectName: example

applications:
  backend:
    type: php:apache
    appRoot: ./wordpress

    apache:
      version: "2.4"
      environmentVariables:
        # The code is in /var/www/html.
        APACHE_DOCUMENT_ROOT: /var/www/html/web

    php:
      version: "8.4"
      environmentVariables:
        WP_HOME: "https://{{ backend.host.0 }}"
        WP_ENV: development
      environmentFiles:
        - ./.env.secrets
      hooks:
        build: |
          composer install --no-interaction --no-dev

    database:
      excludeTablesFromImportOnDevEnvs:
        - wp_users
        - wp_usermeta

    crontab:
      jobs:
        - name: wp-cron
          schedule: "*/15 * * * *"
          # WP-CLI installed with Composer (wp-cli/wp-cli-bundle).
          command: vendor/bin/wp cron event run --due-now

    persistentStorages:
      uploads: web/wp-content/uploads
      tmp: tmp

    overrides:
      - condition:
          environments: [production]
        hosts:
          - example.com
          - www.example.com
        php:
          environmentVariables:
            WP_HOME: "https://example.com"
            WP_ENV: production
```

Things to know:

- The code is read-only, so WordPress can't install or update plugins and themes from its admin pages. Add them with Composer instead, and set `DISALLOW_FILE_MODS` to hide the buttons.
- Uploads go to the `uploads` storage. Point other writable folders, such as caches of plugins, to a storage too.
- Turn off the WordPress cron on page views (`DISABLE_WP_CRON`), as the cron job above runs it.
- Development environments get the database without users, so create one after the deployment.
