Deploy WordPress
WordPress 7.1 with MySQL, installed on first boot, wp-content on a volume
MySQL
Just deployed
/var/lib/mysql
WordPress
Just deployed
/var/www/html/wp-content
Deploy and Host WordPress on Railway
WordPress is the open-source content management system behind a large share of the web. It runs blogs, company sites, portfolios and online shops, with thousands of themes and plugins. You write and manage everything from a browser-based dashboard, and your content stays in your own MySQL database.
About Hosting WordPress
Hosting WordPress means running PHP with a web server, a MySQL database, and persistent storage for themes, plugins and uploads. This template deploys WordPress 7.1.4 from the official Apache image (pinned by digest) with Railway's MySQL, and keeps wp-content on a volume. On first boot it installs WordPress with WP-CLI, so the public install wizard is never exposed: you only enter an admin email, and the admin password is generated. Railway handles HTTPS, and WordPress already trusts Railway's proxy, so there are no redirect loops. PHP uploads are raised to 128 MB. Plan for backups of the volume and database.
Common Use Cases
- Blogs, news sites and personal websites
- Company and marketing sites with a page builder or block theme
- Online shops with WooCommerce, or membership sites with plugins
Dependencies for WordPress Hosting
- MySQL database (Railway MySQL, included)
- A volume for
wp-content(themes, plugins, uploads), included
Deployment Dependencies
- WordPress and its release notes
- Official WordPress Docker image
- WP-CLI
- Template source and changelog
Implementation Details
After deploy, open your Railway domain and log in at /wp-admin with WP_ADMIN_USER (default admin) and WP_ADMIN_PASSWORD from the WordPress service's variables.
- Custom domain: add it in Railway, then update WordPress Address and Site Address under Settings → General (for example
https://YOUR-DOMAIN). - Email: the container can't send mail by itself. Install an SMTP plugin such as WP Mail SMTP for password resets and notifications.
- Updates: WordPress core comes from the image, and only
wp-contentis on the volume. New WordPress versions arrive as template updates that you apply from your Railway project. Don't update core from Dashboard → Updates, because that change is lost on the next redeploy. Plugins and themes update from wp-admin as usual. - Optional variables:
WORDPRESS_CONFIG_EXTRA(extra PHP forwp-config.php),PHP_UPLOAD_LIMIT,PHP_MEMORY_LIMIT.
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
MySQL
mysql:8WordPress
aalfath/wordpress-railway-templateWP_ADMIN_EMAIL
Email address for the WordPress admin account.