Deploy MediaWiki
The wiki software behind Wikipedia, on the official image with MySQL
MySQL
Just deployed
/var/lib/mysql
MediaWiki
Just deployed
/data
Deploy and Host MediaWiki on Railway
MediaWiki is the free, open-source wiki software that runs Wikipedia. It stores pages in a database, keeps the full revision history of every edit, and supports templates, categories, file uploads, search and thousands of extensions. Teams use it to build documentation sites, knowledge bases and community wikis.
About Hosting MediaWiki
Hosting MediaWiki needs a PHP web server, a MySQL or MariaDB database, and persistent storage for uploads and the LocalSettings.php configuration file. Normally you run a web installer, download the generated LocalSettings.php and copy it to the server. This template does that for you. At first start it runs maintenance/install.php with all bundled extensions, creates an Admin user with a generated password, and keeps settings and uploads on a volume. Every later start runs the database updater, so moving to a newer image migrates the schema. $wgServer follows the Railway domain.
Common Use Cases
- Internal documentation and team knowledge base
- Public or community wiki for a product, game or project
- Private notes wiki with page history and file attachments
Dependencies for MediaWiki Hosting
- MediaWiki 1.46.2 (official
mediawikiDocker image, Apache + PHP 8.3) - MySQL 8.4 LTS
Deployment Dependencies
- MediaWiki Docker image: https://hub.docker.com/_/mediawiki
- MediaWiki 1.46 release notes: https://www.mediawiki.org/wiki/Release_notes/1.46
- Command-line installer: https://www.mediawiki.org/wiki/Manual:Install.php
- Start script source: https://github.com/aalfath/mediawiki-railway-template
Implementation Details
First login: open the Railway domain and log in as Admin. The password is the MW_ADMIN_PASSWORD variable on the MediaWiki service. Change it under Preferences. The variable is only read on the first start.
Safe by default: anonymous visitors can read but not edit, and only admins can create accounts (Special:CreateAccount). To change that, set these variables on the MediaWiki service and redeploy:
MW_ANON_EDIT=truelets logged-out visitors edit pagesMW_OPEN_SIGNUP=truelets anyone create an accountMW_PRIVATE_WIKI=truehides all pages from logged-out visitors
Other optional variables: MW_SITE_NAME (default My Wiki), MW_ADMIN_USER (default Admin) and MW_LANG (default en) apply to the first start only. If you add a custom domain, set MW_SERVER=https://wiki.example.com.
Storage: LocalSettings.php (it holds the wiki's secret key) and all uploads live on the MediaWiki volume at /data, and pages live in MySQL. Back up both. Email isn't configured, so password-reset mails aren't sent until you add $wgSMTP settings to /data/LocalSettings.php (for example over railway ssh).
Why Deploy MediaWiki 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 MediaWiki 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:8.4.13MediaWiki
mediawiki:1.46.2