Deploy Wordpress

Self-hosted WordPress with MariaDB, HTTPS and a persistent volume.

Deploy Wordpress

MariaDB

mariadb

Just deployed

/var/lib/mysql

Primary

wordpress

Just deployed

/var/www/html

Deploy and Host WordPress on Railway

WordPress logo

WordPress powers 39.6% of all websites — more than every other CMS combined — with thousands of themes and plugins for blogs, business sites and stores. This template runs the official WordPress image with a MariaDB database on Railway, with HTTPS and your files on a persistent volume. Managed WordPress hosts like WP Engine start at $28/month — run your own WordPress on Railway for ~$5–10/month with full plugin and theme access.


What This Template Deploys

ServicePurpose
PrimaryOfficial wordpress image on Apache, public HTTPS domain. Upload limit raised to 50 MB; site URL set to your Railway domain automatically.
MariaDBMariaDB database for posts, pages, users and settings, reached over Railway's private network.
Persistent VolumeMounted at /var/www/html on Primary — WordPress core, themes, plugins and media uploads survive redeploys.
Persistent VolumeMounted at /var/lib/mysql on MariaDB — your database survives redeploys.

Two services wired together through variable references: WordPress gets the database host, name, user and password from MariaDB, and all eight security keys and salts are generated at deploy time.


About Hosting WordPress

A self-hosted WordPress site needs PHP and a web server, a MySQL-compatible database, storage for uploads and plugins that survives updates, HTTPS, and correct site URLs so redirects and logins work. On a VPS that's a LAMP stack, Certbot and backups to manage yourself.

On Railway, WordPress and MariaDB start together, HTTPS is automatic, WP_HOME and WP_SITEURL point at your Railway domain, and both the site files and the database live on volumes. You install any plugin or theme from the dashboard, with no host restrictions.

Using a custom domain? Update the site URL. WORDPRESS_CONFIG_EXTRA sets WP_HOME and WP_SITEURL to the Railway domain. When you add your own domain, change both to https://yourdomain.com and redeploy, or WordPress will keep redirecting to the old address.

Typical cost: ~$5–10/month on Railway for a small site, including the database. WordPress.com's plugin-capable Personal plan is $4/month billed yearly ($9 monthly), WP Engine starts at $28/month and Kinsta at $30/month.


Deploy WordPress in Under 5 Minutes

  1. Click Deploy on Railway — WordPress and MariaDB start with generated passwords and keys (~2–3 minutes).
  2. Open the public URL and run the WordPress installer: site title, admin user and password.
  3. Sign in at /wp-admin and install your theme and plugins.
  4. Add a caching plugin and an image-optimisation plugin for speed.
  5. For a custom domain, add it in Railway and update WP_HOME and WP_SITEURL in WORDPRESS_CONFIG_EXTRA.

No LAMP stack. No Certbot. No plugin restrictions.


Common Use Cases

  • Self-hosted WordPress hosting — "host wordpress" with full plugin access and no visit caps
  • Business and portfolio sites — any theme from the WordPress directory or marketplaces
  • Blogs and publications — the editor millions of writers already know
  • WooCommerce stores — add WooCommerce for products, carts and payments
  • Client sites for agencies — one Railway project per client, billed by usage
  • Staging copies — clone a site to test plugins and updates safely

Configuration

VariableRequiredDescription
WORDPRESS_DB_HOST, WORDPRESS_DB_NAME, WORDPRESS_DB_USER, WORDPRESS_DB_PASSWORD✅ Auto-injectedDatabase connection from the MariaDB service (private network).
WORDPRESS_AUTH_KEY, …_SALT and the other keys🔐 Auto-generatedWordPress security keys and salts. Changing them logs everyone out.
WORDPRESS_CONFIG_EXTRA✅ SetSets WP_HOME, WP_SITEURL and DOMAIN_CURRENT_SITE to your Railway domain. Update for a custom domain.
MARIADB_PASSWORD, MARIADB_ROOT_PASSWORD🔐 Auto-generatedDatabase passwords.
MARIADB_DATABASE, MARIADB_USEROptionalrailway by default.
PORTAuto-set80, the port Apache listens on.

WordPress email needs a mail plugin. WordPress sends password resets and notifications by email; Railway blocks outbound SMTP on the Hobby plan, so use a mail plugin that sends through an HTTPS API (such as Postmark, Mailgun or SendGrid), or SMTP on Railway Pro.


WordPress on Railway vs. Alternatives

WordPress on RailwayWordPress.comWP EngineKinsta
Monthly cost~$5–10 usage$4 Personal (yearly), $9 monthlyFrom $28From $30 (annual), $35 monthly
Self-hosted✅ Yes❌ No❌ No❌ No
Any plugin or theme✅ Yes✅ From Personal⚠️ Some plugins disallowed⚠️ Some plugins disallowed
Visit limits✅ None, pay for usage✅ None stated❌ 25,000+ by plan❌ 35,000 on Single
Direct database access✅ Your MariaDB❌ No⚠️ phpMyAdmin⚠️ phpMyAdmin
Managed updates and backups⚠️ Your responsibility✅ Yes✅ Yes✅ Yes
License✅ GPL (WordPress)✅ GPL core, proprietary host✅ GPL core, proprietary host✅ GPL core, proprietary host

Dependencies for WordPress Hosting

  • Railway account — Hobby ($5/month) covers a small site; Pro for busy sites or SMTP email.
  • A mail delivery service (Postmark, Mailgun, SendGrid) for password resets and notifications.
  • Optional: a CDN or caching plugin for high-traffic sites.

Deployment Dependencies

Implementation Details

The Primary service runs the official wordpress image on Apache with the prefork MPM, raises PHP's upload and post limits to 50 MB, and serves /var/www/html from a volume, so core files, themes, plugins and uploads persist. WordPress reaches MariaDB on the private network through WORDPRESS_DB_HOST.

WORDPRESS_CONFIG_EXTRA injects WP_HOME, WP_SITEURL and DOMAIN_CURRENT_SITE into wp-config.php using your Railway domain. Both images track their latest tags; pin specific versions once your site is live, and keep WordPress, themes and plugins updated from the dashboard.


Frequently Asked Questions

What does this WordPress template include? The official WordPress image on Apache, a MariaDB database, generated security keys, HTTPS on your Railway domain, and persistent volumes for site files and the database.

How much does it cost compared to managed WordPress hosting? About $5–10/month on Railway for a small site, database included, with no visit limits. WP Engine starts at $28/month, Kinsta at $30/month, and WordPress.com's Personal plan at $4/month billed yearly.

Why does my site redirect to the Railway URL after adding a custom domain? WP_HOME and WP_SITEURL are set in WORDPRESS_CONFIG_EXTRA. Change both to your new domain (with https://) and redeploy.

Do I lose posts, plugins or uploads when I redeploy? No. Posts and settings are in MariaDB on its own volume, and WordPress core, themes, plugins and uploads are on the /var/www/html volume.

Can I install any plugin, including WooCommerce? Yes. It's your own WordPress install, so every plugin and theme works, including WooCommerce.

Who handles updates and backups? You do. Update WordPress, themes and plugins from the dashboard, and enable Railway volume backups or a backup plugin for both the site and database.


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 your own WordPress and MariaDB with HTTPS, persistent storage and full plugin freedom, for a few dollars a month and no visit limits.


Template Content

MariaDB

mariadb

Primary

wordpress

More templates in this category

View Template
Libredesk - Complete Setup
Complete self-hosted omnichannel customer support desk.

codestorm
2
View Template
Paperless-ngx
Paperless-ngx — document management with OCR and full-text search

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

Instatic
170