---
title: "Deploy Wordpress Nginx PHP-FPM Redis"
description: "Production-grade Wordpress 7 on PHP-FPM, mySQL & Redis"
category: "Blogs"
url: https://railway.com/deploy/wordpress-nginx-ph-1
---

# Deploy Wordpress Nginx PHP-FPM Redis

Production-grade Wordpress 7 on PHP-FPM, mySQL & Redis

**[Deploy Wordpress Nginx PHP-FPM Redis on Railway](https://railway.com/template/wordpress-nginx-ph-1)**

- **Creator:** Eetezadi
- **Category:** Blogs
- **Total deploys:** 59

## Template content

### Redis https://cdn.sanity.io/images/sy1jschh/production/0ce0bfdcfbdbf69662b1116671f97c2dd788b655-157x157.svg

- **Image:** redis:8.2.1
- **Start command:** `/bin/sh -c "rm -rf $RAILWAY_VOLUME_MOUNT_PATH/lost+found/ && exec docker-entrypoint.sh redis-server --requirepass $REDIS_PASSWORD --save 60 1 --dir $RAILWAY_VOLUME_MOUNT_PATH"`

### MySQL https://devicons.railway.app/i/mysql.svg

- **Image:** mysql:9.4
- **Start command:** `docker-entrypoint.sh mysqld --innodb-use-native-aio=0 --disable-log-bin --performance_schema=0 --innodb-buffer-pool-size=1G`

### Wordpress + Nginx https://www.freepnglogos.com/uploads/wordpress-logo-png/wordpress-logo-four-fantastic-wordpress-logos-halfblog-18.png

- **Source:** Eetezadi/railway-wordpress-nginx-php-fpm-redis
- **Health check:** /health
- **Public domain:** Yes

### phpMyAdmin https://www.phpmyadmin.net/static/images/logo.png?067b638aa2a2

- **Image:** linuxserver/phpmyadmin:5.2.3
- **Start command:** `/bin/sh -c "mkdir -p /config/nginx && echo 'resolver 8.8.8.8 8.8.4.4 valid=300s;' > /config/nginx/resolver.conf && /init"`
- **Public domain:** Yes

## Documentation

# Deploy and Host WordPress 7 Nginx PHP-FPM Redis on Railway

A production-ready WordPress deployment featuring a security-hardened custom Docker image with Nginx and PHP-FPM 8.4, integrated with Railway's managed MySQL and Redis databases, plus a phpMyAdmin interface for database management.

## About Hosting WordPress 7 Nginx PHP-FPM Redis

Hosting WordPress with Nginx, PHP-FPM, and Redis involves deploying a high-performance web stack optimized for production environments. This configuration uses Nginx as the web server for efficient request handling, PHP-FPM 8.4 for processing PHP code, and Redis for persistent object caching and session storage. The setup includes security hardening measures such as XML-RPC disabling, protected wp-config.php, upload directory PHP execution blocking, and security headers. Railway's managed MySQL database handles persistent data storage, while phpMyAdmin provides a web-based interface for database administration. WP-CLI is pre-installed for advanced command-line site management.

## Common Use Cases

- **High-Traffic Blogs and Content Sites**: Redis object caching significantly reduces database load for content-heavy websites with frequent page views
- **E-commerce Platforms**: Performance-optimized stack handles product catalogs, shopping carts, and checkout flows with improved response times
- **Membership and Community Sites**: Session storage and object caching support user authentication and dynamic content delivery at scale

## Dependencies for WordPress Nginx PHP-FPM Redis Hosting

- **MySQL Database**: Railway's managed MySQL service for WordPress data persistence
- **Redis Database**: Railway's managed Redis service for object caching and session storage
- **phpMyAdmin**: Optional web-based MySQL database management interface

### Deployment Dependencies

- [Redis Object Cache Plugin](https://wordpress.org/plugins/redis-cache/) - WordPress plugin by Till Krüss for Redis integration
- [Railway MySQL Service](https://docs.railway.app/databases/mysql) - Managed MySQL database documentation
- [Railway Redis Service](https://docs.railway.app/databases/redis) - Managed Redis database documentation

### Implementation Details

**Required Post-Deployment Setup**
1. **Enable Redis Caching**: Install and activate the Redis Object Cache plugin
   - Log into WordPress admin dashboard
   - Navigate to **Plugins** → **Add New**
   - Search for **"Redis Object Cache"** (by Till Krüss)
   - Click **Install Now**, then **Activate**
   - Navigate to **Settings** → **Redis** → **Enable Object Cache**
   - Verify connection status shows **"Connected"**

2. **Configure Custom Domain** (optional):
   - Go to WordPress service → **Settings** → **Networking** → **Public Networking**
   - Click **Custom Domain** and enter your domain
   - **Port**: Use **80** (Railway handles SSL automatically)
   - Point your domain's DNS to the provided Railway address
   - Wait 1-2 minutes for SSL certificate provisioning

All environment variables are configured automatically by Railway. The template includes dynamic domain detection, so WordPress automatically adapts to any domain you add.

The template uses a custom Docker image with the following configuration:

**Nginx Configuration**
- Optimized for WordPress with security rules blocking common attack vectors
- Client max body size configurable via `NGINX_CLIENT_MAX_BODY_SIZE` (default: 256M)

**PHP-FPM 8.4 Settings**
```
PHP_MEMORY_LIMIT=512M (configurable)
PHP_UPLOAD_MAX_FILESIZE=256M (configurable)
PHP_POST_MAX_SIZE=256M (configurable)
```

**Security Hardening**
- XML-RPC disabled to prevent brute force attacks
- wp-config.php access blocked at web server level
- PHP execution prevented in uploads directory
- Security headers enabled (X-Frame-Options, X-Content-Type-Options, etc.)
- Hidden file protection (.htaccess, .git, etc.)

**Redis Integration**
- Automatic connection to Railway Redis with password authentication
- Persistent object caching reduces database queries by 80%+ on average
- Session storage for improved scalability

**WP-CLI Pre-installed**
```bash
wp plugin list
wp cache flush
wp user list
```

**Persistent Storage**
- Volume mounted at `/var/www/html` for WordPress files
- Ensures uploads and plugins persist across deployments

## Why Deploy WordPress 7 Nginx PHP-FPM Redis 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 Nginx PHP-FPM Redis 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.


## Similar templates

- [Pixelfed](https://railway.com/deploy/OZSdEw) — Explore + Share beautiful photos and videos on the Fediverse
- [Hexo](https://railway.com/deploy/hexo) — Self-hosted Hexo blog with editor, comments, and S3 storage
- [NodeBB](https://railway.com/deploy/nodebb) — Node.js based forum software built for the modern web

Open this page in a browser: https://railway.com/deploy/wordpress-nginx-ph-1
