Railway

Deploy WordPress — Self-Hosted CMS with MariaDB on Railway

Self-host WordPress + MariaDB. No traffic caps. No renewal price hikes.

Deploy WordPress — Self-Hosted CMS with MariaDB on Railway

Just deployed

/var/lib/mysql

Wordpress

wordpress

Just deployed

/var/www/html

Deploy and Host WordPress on Railway

WordPress self-hosted CMS dashboard

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

ServicePurpose
WordPressThe CMS — official wordpress image on Apache (MPM Prefork for PHP compatibility), serving your site with the full plugin and theme ecosystem on port 80
MariaDBManaged 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

  1. Click Deploy on Railway — WordPress and MariaDB build automatically (~2 minutes)
  2. Database credentials, security keys, and your public domain are wired automatically
  3. Open your Railway-assigned URL — the WordPress 5-minute install wizard loads
  4. Set your site title, admin username, and a strong password
  5. Log in at /wp-admin and install your theme and plugins

No cPanel. No FTP. No SSH. No SSL configuration.

WordPress installation wizard on Railway


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

VariableRequiredDescription
WORDPRESS_DB_HOST✅ Auto-wiredMariaDB host:port — injected from the MariaDB service
WORDPRESS_DB_NAME✅ Auto-wiredDatabase name (railway)
WORDPRESS_DB_USER✅ Auto-wiredDatabase user (railway)
WORDPRESS_DB_PASSWORD✅ Auto-generated32-char database password
WORDPRESS_CONFIG_EXTRA✅ Pre-setSets WP_HOME, WP_SITEURL, DOMAIN_CURRENT_SITE
WORDPRESS_AUTH_KEY / WORDPRESS_AUTH_SALT✅ Auto-generatedWordPress security salts (all 8 generated)
MARIADB_ROOT_PASSWORD✅ Auto-generatedMariaDB root password
WORDPRESS_TABLE_PREFIXOptionalTable prefix — defaults to wp_. Change for security on public sites
PORT✅ Pre-setWordPress 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 EngineKinstaSiteGround (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

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 than latest in service settings. An unpinned latest tag 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

Wordpress

wordpress

More templates in this category

View Template
Libredesk - Complete Setup
[Jun'26] Complete self-hosted omnichannel customer support desk.

codestorm
1
View Template
Instatic CMS - Postgres
Design, build and manage powerful static sites from state-of-the-art CMS

Instatic
17
View Template
Strapi
A popular self-hosted CMS

Milo
7.6K