
Deploy WordPress (MPM fix + MySQL + Node.js/Docker)
Supports seamless local dev (sync plugins/themes/uploads)
MySQL
Just deployed
/var/lib/mysql
WordPress
Just deployed
/var/www/html
WordPress on Railway
Easily deploy WordPress on Railway with seamless support for local development out of the box.
This templates does not crash on deployment due to the more than one MPM loaded error.
Focal point of this template compared to the others is the local development, so you can easily create/manage custom WordPress plugins, themes and uploads without relying on Railway's SSH to access the files.
The template is flexible and extendable so you can even use it in a monorepo or other project structures.
Common Use Cases
- You prefer self-hosting WordPress.
- You want to develop WordPress plugins and themes.
- You want to use WordPress as a headless CMS (API) for your frontend application.
- You have an existing WordPress installation and want to migrate/use it on Railway.
Deploy and Host
- Click the button to use the template.
- Follow the instructions (zero-config).
- Open the URL assigned by Railway in your browser (eg. https://your-app-name.up.railway.app).
- Enjoy!
Deployment Dependencies
- WordPress Docker image
- MySQL Docker image
- Node.js (optional - for local developyment)
About Hosting
This template creates the Apache server (WordPress) and MySQL database for you.
The domain for the WordPress application will be the provided public domain by Railway or your own domain.
Local Development
In case you want to develop WordPress locally.
- Manage plugins, themes and uploads locally in these directories:
./data/plugins./data/themes./data/uploads
- Will automatically sync local changes to WordPress.
- Add an existing WordPress installation in
./data/migrateto use it as the base installation. - Only
plugins,themesanduploadsare synced, the rest are ignored by default to avoid messing up the core files of WordPress.- Feel free to add more directories if you need them.
Helper Commands
yarn start
Starts the WordPress server.
yarn stop
Stops the WordPress server.
yarn restart
Stops the WordPress server and then starts it again.
yarn clean
Stops the WordPress server and deletes the docker container including it's image and volumes.
IMPORTANT: This will delete all data in the volumes, so make sure you have a backup of your data before running this command.
yarn clean:restart
Stops the WordPress server, deletes the docker container including it's image/volumes and then starts the WordPress server again.
IMPORTANT: This will delete all data in the volumes, so make sure you have a backup of your data before running this command.
yarn dirs
Generates these directories:
data/pluginsdata/themesdata/uploadsdata/migrate
yarn dirs:clean
Removes all files and folders inside these directories:
data/pluginsdata/themesdata/uploadsdata/migrate
Dependencies for this template
Prerequisites for local development.
- Docker
- Node.js & npm (optional)
- Only required for running the helper commands (eg.
yarn startandyarn stop) which are easier to remember and more efficient than using the docker commands manually.
- Only required for running the helper commands (eg.
Setup
Assuming you have already deployed the template on Railway:
- Clone the upstream repository or create a new one using it as a template.
- Publish the repository to GitHub.
- At Railway change the
Source Repoto your cloned repository to automatically redeploy the service from your own GitHub commits (optional). - Either run:
yarn installand thenyarn startto start the server.- or
docker compose -f compose.yaml up.
- Open http://localhost:8080 in your browser to access WordPress.
Troubleshooting
Report any issues or suggestions on GitHub or Railway.
Missing Directories
If you accidentally delete the directories data/plugins, data/themes, data/uploads or data/migrate you can run yarn dirs to recreate them.
"dependency failed to start: container wordpress-railway-wordpress-db-1 is unhealthy"
If you get this error upon container startup in your local environment, you should try one or more of the following:
-
Stop the container with
yarn stopordocker compose -f compose.yaml downand restart it withyarn startordocker compose -f compose.yaml up. -
If the issue persists, you can try to delete the container including it's image and volumes by running
yarn cleanordocker compose -f compose.yaml down --volumes --rmi alland then recreate it withyarn startordocker compose -f compose.yaml up(IMPORTANT: This will delete all data in the volumes, so make sure you have a backup of your data before running this command).
Why Deploy this template 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 (Node.js/Docker) 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.
License
- WordPress: GPL-2.0 (GNU General Public License v2.0).
- MySQL: GPL-2.0 (GNU General Public License v2.0).
Template Content
MySQL
mysql:9.4WordPress
deltabox-studio/wordpress-railway