---
title: "Deploy WordPress | Installs on First Visit, Private Database, Pinned"
description: "Self-host WordPress on Railway — installs on first visit, private MariaDB."
category: "CMS"
url: https://railway.com/deploy/wordpress-or-installs-on-first-visit-pri
---

# Deploy WordPress | Installs on First Visit, Private Database, Pinned

Self-host WordPress on Railway — installs on first visit, private MariaDB.

**[Deploy WordPress | Installs on First Visit, Private Database, Pinned on Railway](https://railway.com/template/wordpress-or-installs-on-first-visit-pri)**

Machine-readable deploy manifest (JSON, validated by TemplateCI): https://railway.com/deploy/wordpress-or-installs-on-first-visit-pri/manifest.json

- **Creator:** Templates Guru
- **Category:** CMS

## Template content

### WordPress

- **Image:** wordpress:7.1.2-php8.4-apache
- **Start command:** `/bin/sh -c "a2dismod -q mpm_event mpm_worker; a2enmod -q mpm_prefork; printf 'upload_max_filesize=64M\npost_max_size=64M\n' > /usr/local/etc/php/conf.d/uploads.ini; exec docker-entrypoint.sh apache2-foreground"`
- **Public domain:** Yes

### MariaDB

- **Image:** mariadb:11.4.13

## Documentation

# Deploy and Host WordPress on Railway

WordPress with MariaDB, pinned, and installing on the first visit: open the domain and you land on WordPress's own setup screen. The database is reachable only inside the project.

Nothing to fill in. Open the domain, pick a language, and create the admin account.

## About Hosting WordPress

Two services:

- **WordPress** `7.1.2` on PHP 8.4 and Apache, with a volume for core files, themes, plugins and uploads (public)
- **MariaDB** `11.4` LTS, on its own volume, on the private network only

WordPress generates its own security keys and salts on first start and keeps them in `wp-config.php` on the volume, so they survive redeploys.

## Common Use Cases

- **A blog or company site** with the full WordPress plugin and theme ecosystem.
- **A WooCommerce shop** on your own database.
- **A staging copy** of an existing WordPress site for testing plugins and updates.

## Dependencies for WordPress Hosting

### Deployment Dependencies

- WordPress `wordpress:7.1.2-php8.4-apache` (public)
- MariaDB `mariadb:11.4.13`
- [WordPress](https://wordpress.org), GPL-2.0, and [MariaDB](https://mariadb.org), GPL-2.0. This template only configures their official images.

### Implementation Details

- **The site is actually installed.** On Railway the stock image stops with `AH00534: More than one MPM loaded`, and the usual fix, a start command that disables the extra MPMs and then calls `docker-entrypoint.sh a2dismod …`, has a side effect: the entrypoint only copies WordPress into the volume when its first argument is `apache2-foreground`. The site then answers every request with 403 from an empty directory, while the deploy reports success. Here the start command disables the extra MPMs and then hands over to `docker-entrypoint.sh apache2-foreground`, so the files are copied and Apache starts with one MPM.
- **The database is private.** No TCP proxy: MariaDB answers only on the project's private network, and WordPress reaches it by its private domain.
- **Uploads up to 64 MB.** PHP's default limit is 2 MB, too small for most themes and plugin zips.
- **Every image is pinned**, so a deploy next month gets the same WordPress and the same database as today. Upgrade WordPress itself from its dashboard.
- **No health check path.** Railway accepts only letters and slashes in a health check path, and WordPress has no such URL that answers 200 both before and after installation.

### Configuration

The MariaDB passwords are generated. To serve the site on your own domain, add it in the WordPress service's networking settings, then change the WordPress Address and Site Address under Settings → General.

### Verification

Deployed from this template into an empty project, both services starting at once: live in under a minute, the domain redirects to `/wp-admin/install.php`, and the installer's second screen opens without a database error, which means WordPress reached MariaDB with the generated credentials. The installation itself was not completed during testing.

## Why Deploy WordPress on Railway?

Railway is a singular platform to deploy your infrastructure stack. Railway will host your infrastructure so you don't have to deal with configuration, while allowing you to vertically and horizontally scale it.

By deploying WordPress on Railway, you are one step closer to supporting a complete full-stack application with minimal burden. Host your servers, databases, AI agents, and more on Railway.


## Similar templates

- [Libredesk - Complete Setup](https://railway.com/deploy/libredesk-complete-setup) — Complete self-hosted omnichannel customer support desk.
- [Paperless-ngx](https://railway.com/deploy/paperless-ngx-3) — Paperless-ngx — document management with OCR and full-text search
- [Instatic CMS - Postgres](https://railway.com/deploy/instatic-cms-postgres) — Design, build and manage powerful static sites from state-of-the-art CMS

Open this page in a browser: https://railway.com/deploy/wordpress-or-installs-on-first-visit-pri
