Deploy WordPress (MariaDB, WP-CLI)

WordPress 7 on MariaDB: 128 MB uploads, HTTPS behind the proxy, WP-CLI

Deploy WordPress (MariaDB, WP-CLI)

Just deployed

Deploy and Host WordPress (MariaDB, WP-CLI) on Railway

This template runs the official WordPress 7.1 image on PHP 8.4 with MariaDB 11.8 LTS. Uploads go up to 128 MB, WordPress knows it's served over HTTPS behind Railway's proxy, and WP-CLI is installed. The site files and the database each live on a volume.

The official WordPress image doesn't start on Railway as is. Apache stops with "More than one MPM loaded". I traced it: the image turns off one Apache module by deleting its link in a later layer, and on Railway that link is back at runtime. The popular WordPress templates here work around it with a long start command that also patches php.ini on every boot, and they run unpinned latest images. This one fixes it inside the image and pins the versions.

About Hosting WordPress (MariaDB, WP-CLI)

When the deploy finishes, open WORDPRESS_URL from the Variables tab of the WordPress service. You land on the WordPress installer: pick a site title and an admin login, and you're done.

Before publishing I ran the whole thing end to end. The installer finished, and the home page had 30 links on https and none on http. I created an application password, which WordPress only allows over HTTPS, and used it to upload an 8 MB file through the REST API in 1.1 seconds. Then I restarted WordPress and MariaDB at the same time. The site was back 51 seconds later, still installed, and the file downloaded fine.

At idle WordPress used 246 MB of RAM and MariaDB 163 MB, about $4 a month together.

Common Use Cases

  • A blog or a small business site on your own domain
  • A headless CMS: the REST API and application passwords work over HTTPS, so a Next.js or Astro front end can read and write content

Dependencies for WordPress (MariaDB, WP-CLI) Hosting

None. The database, its password and the connection between the two services are set up for you.

Deployment Dependencies

Implementation Details

To use your own domain, add it in the WordPress service's Settings on Railway, then change WordPress Address and Site Address under Settings, General in WordPress.

WordPress core, themes, plugins and uploads live on the WordPress volume, so updates from the WordPress dashboard stick. The image version only matters for the first install.

WP-CLI is in the image. Open a shell with railway ssh from the Railway CLI and run it as root, for example wp --allow-root plugin list.

WordPress sends email with PHP's mail(), and there's no mail server in this setup, so password reset emails won't arrive until you install an SMTP plugin and connect a provider such as Resend or Postmark.

The PHP limits (128 MB uploads, 256 MB memory) are set in the image. Apache takes the visitor's address from Railway's X-Real-IP header, so the access logs and security plugins that block by IP see visitors instead of Railway's proxy.

Why Deploy WordPress (MariaDB, WP-CLI) on Railway?

You get a WordPress site without renting and patching a server, and the bill follows the RAM it uses. Both volumes survive redeploys, so updating the image or restarting doesn't touch your content.


Template Content

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
166