Deploy WordPress — Self-Hosted CMS with MariaDB on Railway
Self-host WordPress + MariaDB. No traffic caps. No renewal price hikes.
Mariadb
Just deployed
/var/lib/mysql
Wordpress
Just deployed
/var/www/html
Deploy and Host WordPress on Railway

WordPress is the world's most popular open-source CMS — powering 43% of all websites, from
personal blogs to enterprise e-commerce. This template deploys a production-ready WordPress
instance with a MariaDB database, persistent volumes for files and database, auto-generated
security keys, and WP_HOME/WP_SITEURL wired to your Railway domain automatically. No LAMP
stack setup, no SSL wrangling, no manual configuration.
Self-host WordPress for ~$5–10/month — versus WP Engine at $30/month, Kinsta at $35/month, or SiteGround which renews at $29.99/month. No traffic caps. No renewal price hikes. Full ownership of your site and data.
What This Template Deploys
| Service | Purpose |
|---|---|
| WordPress | The CMS — official wordpress image on Apache (MPM Prefork for PHP compatibility), serving your site with the full plugin and theme ecosystem on port 80 |
| MariaDB | Managed database — posts, pages, users, settings, and all plugin data, with auto-generated credentials |
| Persistent Volumes | /var/www/html (WordPress files) and /var/lib/mysql (database) — both survive every redeploy |
Both services connect over Railway's private network — MariaDB is never exposed to the public internet. All 8 WordPress security salts and database credentials are generated automatically.
About Hosting WordPress
Traditional shared WordPress hosting puts your site on overcrowded servers, imposes traffic caps, and triples renewal rates after year one. Managed hosts like WP Engine and Kinsta solve performance but start at $30–35/month for a single site with visitor caps. Running WordPress yourself on a VPS means configuring Apache, PHP, MariaDB, SSL, and patching all of it forever.
Railway eliminates all of that. This template runs the official WordPress and MariaDB images over private networking with persistent volumes, automatic HTTPS, and an environment-variable UI for rotating secrets without SSH. The full two-container stack is live in under two minutes.
Typical cost: ~$5–10/month on Railway's Hobby plan. WP Engine starts at $30/month, Kinsta at $35/month, and SiteGround renews at $29.99/month — all with visitor caps. Railway has no traffic limits and no renewal pricing.
Deploy in Under 5 Minutes
- Click Deploy on Railway — WordPress and MariaDB build automatically (~2 minutes)
- Database credentials, security keys, and your public domain are wired automatically
- Open your Railway-assigned URL — the WordPress 5-minute install wizard loads
- Set your site title, admin username, and a strong password
- Log in at
/wp-adminand install your theme and plugins
No cPanel. No FTP. No SSH. No SSL configuration.

Common Use Cases
- Managed WordPress alternative to WP Engine — dedicated container infrastructure without the $30/month single-site cap, visitor limits, or annual contract
- Run WooCommerce without Shopify transaction fees — full e-commerce store with WooCommerce, Stripe/PayPal gateways, and inventory management; no per-transaction platform cut
- WordPress with a dedicated database instead of shared hosting — Railway provisions a private MariaDB per deployment; no shared database servers, no noisy neighbours
- Membership and subscription sites — gated content with MemberPress or Paid Memberships Pro on infrastructure that doesn't throttle you during launches
- Agency client WordPress hosting — deploy isolated WordPress instances per client; each gets its own container, database, and volume with no cross-contamination
- Digital product and course stores — sell e-books, courses, or software with Easy Digital Downloads and automated delivery on a dedicated stack
Configuration
| Variable | Required | Description |
|---|---|---|
WORDPRESS_DB_HOST | ✅ Auto-wired | MariaDB host:port — injected from the MariaDB service |
WORDPRESS_DB_NAME | ✅ Auto-wired | Database name (railway) |
WORDPRESS_DB_USER | ✅ Auto-wired | Database user (railway) |
WORDPRESS_DB_PASSWORD | ✅ Auto-generated | 32-char database password |
WORDPRESS_CONFIG_EXTRA | ✅ Pre-set | Sets WP_HOME, WP_SITEURL, DOMAIN_CURRENT_SITE |
WORDPRESS_AUTH_KEY / WORDPRESS_AUTH_SALT | ✅ Auto-generated | WordPress security salts (all 8 generated) |
MARIADB_ROOT_PASSWORD | ✅ Auto-generated | MariaDB root password |
WORDPRESS_TABLE_PREFIX | Optional | Table prefix — defaults to wp_. Change for security on public sites |
PORT | ✅ Pre-set | WordPress container port (80) |
All database connection variables and security salts are generated and wired automatically. You do not need to set them manually — deploy and go straight to the install wizard.
WordPress on Railway vs. Managed Hosting
| Railway (~$5–10/mo) | WP Engine | Kinsta | SiteGround (renewal) | |
|---|---|---|---|---|
| Entry price | ~$5–10/mo flat | $30/mo | $35/mo | $29.99/mo |
| Renewal price hike | ✅ None | ❌ Contract-based | ❌ Annual billing | ❌ Steep jump |
| Traffic / visitor cap | ✅ None | ❌ 25,000/mo | ❌ 25,000/mo | ❌ 10,000/mo |
| Dedicated database | ✅ Private MariaDB | ✅ Yes | ✅ Yes | ❌ Shared |
| Plugin freedom | ✅ Any plugin | ⚠️ Some banned | ⚠️ Some banned | ✅ Any |
| Data ownership | ✅ Your infra | ❌ WP Engine | ❌ Kinsta/GCP | ❌ SiteGround |
| WooCommerce | ✅ Full support | ✅ Yes | ✅ Yes | ✅ Yes |
| Multi-site per price | ✅ Per project | ❌ Extra cost | ❌ Extra cost | ❌ Extra cost |
Dependencies for WordPress Hosting
- Railway account — Hobby plan (~$5–10/month) covers WordPress, MariaDB, and volumes
- A custom domain (optional — Railway provides a public domain; custom domains are free to add)
- Optional: Cloudflare in front for CDN and DDoS protection
Deployment Dependencies
- WordPress Docker Image — official
- MariaDB Docker Image — official
- WordPress.org — source and plugin repository
- WooCommerce — e-commerce plugin
- Railway Custom Domains
Implementation Details
This template runs the official wordpress image on Apache with MPM Prefork (enforced via a
custom start command for PHP compatibility), connected to the official mariadb image over
Railway's private network. The /var/www/html and /var/lib/mysql volumes persist files and
database across every redeploy.
Production note: Pin the MariaDB image to a specific version (e.g.
mariadb:11.4) rather thanlatestin service settings. An unpinnedlatesttag can pull a new major version on redeploy and break database compatibility — pinning protects your production site.
Frequently Asked Questions
How much does WordPress on Railway cost vs WP Engine or Kinsta? The full stack runs at ~$5–10/month on Railway's Hobby plan. WP Engine starts at $30/month for one site with a 25,000 visit cap. Kinsta starts at $35/month with the same limit. SiteGround renews at $29.99/month after the intro period. Railway has no visitor caps and no renewal hikes.
Do I lose my content and media if Railway redeploys?
No. Posts, pages, and settings live in the MariaDB volume; media and theme files live in the
/var/www/html volume. Both persist independently of the containers — redeploys, updates, and
restarts don't affect your data.
Can I run WooCommerce on this deployment? Yes. WooCommerce installs as a standard plugin with no restrictions. The MariaDB database handles WooCommerce's tables without additional configuration, and you can connect Stripe or PayPal gateways directly.
Can I use a custom domain instead of the Railway URL? Yes. Add your domain under the WordPress service's Custom Domains settings. Railway provisions HTTPS for custom domains automatically — no SSL certificate purchase or renewal needed.
How do I update WordPress to a newer version?
Update from the WordPress admin dashboard at /wp-admin like any WordPress site. For
container-level updates, change the image tag in Railway service settings and redeploy — your
MariaDB data and volume files are unaffected.
Can I run multiple WordPress sites on one Railway account? Yes. Deploy a separate Railway project per site. Each gets its own WordPress container, MariaDB database, and volume — no cross-contamination and no per-site add-on fee beyond compute usage.
Why Deploy and Host 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 get a production-grade CMS with a dedicated MariaDB database, persistent media storage, automatic HTTPS, and no traffic caps — at ~$5–10/month flat with no renewal price hikes and full ownership of your site, data, and infrastructure.
Template Content
Mariadb
mariadb:latestWordpress
wordpress