Deploy WordPress | Installs on First Visit, Private Database, Pinned
Self-host WordPress on Railway — installs on first visit, private MariaDB.
WordPress
Just deployed
/var/www/html
MariaDB
Just deployed
/var/lib/mysql
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.2on PHP 8.4 and Apache, with a volume for core files, themes, plugins and uploads (public) - MariaDB
11.4LTS, 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, GPL-2.0, and MariaDB, 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 callsdocker-entrypoint.sh a2dismod …, has a side effect: the entrypoint only copies WordPress into the volume when its first argument isapache2-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 todocker-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.
Template Content
WordPress
wordpress:7.1.2-php8.4-apacheMariaDB
mariadb:11.4.13