Skip to main content
Before you start, check out the Upsun demo app and the main Getting started guide. They provide all the core concepts and common commands you need to know before using the following materials.
For WordPress to successfully deploy and operate, after completing the Getting started guide, you still need to add some required files and make a few changes to your Upsun configuration.

Assumptions

There are many ways you can set up a WordPress site or Upsun project. The instructions on this page were designed based on the following assumptions:
  • You are building a Bedrock-based WordPress site using Roots.io Bedrock boilerplate.
  • You have an existing Bedrock-based codebase or created a new Composer project using roots/bedrock during the Getting started guide.
  • You selected PHP as your runtime, and MariaDB as a service during the Getting Started guide. It’s also assumed that while using the Getting Started guide you named the project myapp, which you will notice is the top-level key in all configuration below.

1. Configure your root location

Locate the web:locations section and update the root (/) location as follows:

2. Set up a location for uploads

Application containers are read-only by default; WordPress needs a writable location to store uploaded media. To make the location writable, set up a mount. To do so, locate the mounts: section that is commented out, and update it as follows:

3. Install dependencies during the build hook

To ensure your Composer dependencies are installed during the build stage, locate the build: section (below the hooks: section).
Update the build: section as follows:
You can adjust the composer install command to meet your specific requirements.

4. Launch tasks during the deploy hook

Once the images for our application have been built, there are a few key tasks that must be completed before our newly-built application can receive requests. These tasks include: application can receive requests. Such tasks include:
  • Flushing the object cache, which might have changed between current production and newly deployed changes
  • Running the WordPress database update procedure, in case core is being updated with the newly deployed changes
  • Running any due cron jobs
To perform these tasks, we’ll utilize the deploy hook. Locate the deploy: section (below the build: section). Update the deploy: and post_deploy: sections as follows:

5. Update App container depdencies

Add the wp-cli tool and composer to your application build. Locate the dependencies: section that is commented out, and update it as follows:

6. Configure your default route

Locate the routes: section, and beneath it, the "https://{default}/": route. Update the route as follows: Matching the application name APP_NAME with the upstream definition APP_NAME:http is the most important setting to ensure at this stage. If these strings aren’t the same, the WordPress deployment will not succeed.

7. Add your crons

Under your application configuration you can now add a cron.

8. Update .environment

The CLI generated a .environment file during the Getting started guide. Notice it has already created some environment variables for you to connect to your database service.
.environment
# Set database environment variables
export DB_HOST="$MARIADB_HOST"
export DB_PORT="$MARIADB_PORT"
export DB_PATH="$MARIADB_PATH"
export DB_DATABASE="$DB_PATH"
export DB_USERNAME="$MARIADB_USERNAME"
export DB_PASSWORD="$MARIADB_PASSWORD"
export DB_SCHEME="$MARIADB_SCHEME"
export DATABASE_URL="${DB_SCHEME}://${DB_USERNAME}:${DB_PASSWORD}@${DB_HOST}:${DB_PORT}/${DB_PATH}"
To configure the remaining environment variables that WordPress needs to run smoothly, follow these steps.
  1. Open the .environment file for editing
  2. Add the following at the end of the file:
    .environment
     # Routes, URLS, and primary domain
     export SITE_ROUTES="$(echo "$PLATFORM_ROUTES" | base64 --decode)"
     export UPSTREAM_URLS="$(
       echo "$SITE_ROUTES" | jq -r --arg app "$PLATFORM_APPLICATION_NAME" \
         'map_values(select(.type == "upstream" and .upstream == $app)) | keys'
     )"
     export DOMAIN_CURRENT_SITE="$(
       echo "$SITE_ROUTES" | jq -r --arg app "$PLATFORM_APPLICATION_NAME" \
         'map_values(select(.primary == true and .type == "upstream" and .upstream == $app))
           | keys | .[0]
           | if (.[-1:] == "/") then (.[0:-1]) else . end'
     )"
    
     export WP_HOME="${DOMAIN_CURRENT_SITE}"
     export WP_SITEURL="${WP_HOME}/wp"
     export WP_DEBUG_LOG="/var/log/app.log"
     # Uncomment this line if you would like development versions of WordPress on non-production environments.
     # export WP_ENV="${PLATFORM_ENVIRONMENT_TYPE}"
     export AUTH_KEY="${PLATFORM_PROJECT_ENTROPY}AUTH_KEY"
     export SECURE_AUTH_KEY="${PLATFORM_PROJECT_ENTROPY}SECURE_AUTH_KEY"
     export LOGGED_IN_KEY="${PLATFORM_PROJECT_ENTROPY}LOGGED_IN_KEY"
     export NONCE_KEY="${PLATFORM_PROJECT_ENTROPY}NONCE_KEY"
     export AUTH_SALT="${PLATFORM_PROJECT_ENTROPY}AUTH_SALT"
     export SECURE_AUTH_SALT="${PLATFORM_PROJECT_ENTROPY}SECURE_AUTH_SALT"
     export LOGGED_IN_SALT="${PLATFORM_PROJECT_ENTROPY}LOGGED_IN_SALT"
     export NONCE_SALT="${PLATFORM_PROJECT_ENTROPY}NONCE_SALT"
    

9. Commit, Push, and Deploy!

You can now commit all the changes made to .upsun/config.yaml and .environment and push to Upsun.
Terminal
git add .
git commit -m "Add changes to complete my Upsun configuration"
upsun push -y

9. Routinely run WP Cron (optional)

If your site does not receive enough traffic to ensure WP Cron jobs run in a timely manner, or your site uses caching heavily such that WP Cron isn’t being triggered, you might consider adding a cron job to your project’s configuration to have WP CLI run those scheduled tasks on a routine basis. To do so, locate the crons: section that is commented out, and update it as follows: The above example will trigger the wp-cli every 15th minute to run WP Cron tasks that are due. Feel free to adjust based on your individual requirements.
When uncommenting, pay attention to the indentation and make sure that the crons key aligns with other sibling keys (e.g. hooks, dependencies, etc.)

Further resources

Documentation

Community content

Blogs

Last modified on March 11, 2026