Deploying a WordPress App
Introduction
WordPress is the world’s most popular content management system (CMS), powering over 43% of all websites on the internet. Since its launch in 2003, WordPress has evolved from a simple blogging platform into a powerful, versatile CMS capable of building anything from personal blogs to enterprise websites, online stores, membership sites, and complex web applications.
Built with PHP and MySQL, WordPress offers an intuitive admin interface, thousands of free and premium themes, over 60,000 plugins extending functionality, a robust REST API, built-in SEO optimization, multi-language support, and a thriving global community of developers and users. Whether you’re launching a personal blog, building a business website, or creating a custom web application, WordPress provides the flexibility and tools you need.
Deploying WordPress on Klutch.sh gives you automatic Docker detection, persistent storage for media files and custom code, seamless MySQL database integration, automatic HTTPS certificates, custom domain support, and simplified deployment workflow. This comprehensive guide walks you through deploying WordPress with production-ready configuration, including database setup, persistent volume management, security best practices, and performance optimization.
Why Deploy WordPress on Klutch.sh?
- Simplified Infrastructure: Launch your WordPress site without managing complex server configurations
- Automatic HTTPS: Built-in SSL certificates for secure connections
- Persistent Storage: Reliable volume storage for uploads, themes, and plugins
- Custom Domains: Use your own domain for professional branding
- Database Integration: Easy connection to MySQL or MariaDB databases
- Environment Variables: Secure configuration management through the dashboard
- Easy Scaling: Adjust resources as your traffic grows
- Zero Downtime Updates: Deploy updates without interrupting your site
- Container Benefits: Isolated, reproducible environment with version control
- GitHub Integration: Automated deployments from your repository
- Global CDN Ready: Easy integration with CDN services for optimal performance
Prerequisites
Before you begin, ensure you have:
- A Klutch.sh account
- A GitHub account with a repository for your deployment
- Basic understanding of Docker and PHP applications
- (Recommended) MySQL or MariaDB database deployed - see our MySQL deployment guide or MariaDB deployment guide
- Understanding of WordPress basics and content management systems
Understanding WordPress Architecture
WordPress is built on a classic LAMP stack architecture:
Core Components:
- PHP Application: WordPress core written in PHP (8.0+ recommended)
- Web Server: Apache or Nginx serving the application
- MySQL Database: Stores posts, pages, users, settings, and all content
- File System: Stores themes, plugins, uploads, and configuration
- wp-config.php: Main configuration file with database credentials
- wp-content: Directory containing themes, plugins, and uploads
Default Structure:
/var/www/html/├── index.php # Main entry point├── wp-config.php # Configuration file├── wp-admin/ # Admin dashboard├── wp-includes/ # Core WordPress files├── wp-content/ # User content (persist this!)│ ├── themes/ # Theme files│ ├── plugins/ # Plugin files│ ├── uploads/ # Media library│ └── languages/ # Translation files├── .htaccess # Apache rewrite rules└── xmlrpc.php # XML-RPC endpointKey Features:
- WYSIWYG visual editor (Gutenberg block editor)
- Media library for image/file management
- User roles and permissions system
- Built-in commenting system
- Custom post types and taxonomies
- Widgets and menus for site structure
- Theme customizer for visual changes
- Plugin architecture for extending functionality
- REST API for headless CMS usage
- Multisite capability for network installations
- Built-in SEO features and permalink management
- Automatic updates for core, themes, and plugins
- Import/export tools
- Built-in search functionality
When deploying on Klutch.sh, we’ll containerize WordPress with Apache/PHP and connect it to a separately deployed MySQL instance for optimal performance and easier maintenance.
Preparing Your Repository
Step 1: Create Project Directory
Create a new directory for your WordPress deployment:
mkdir wordpress-deploycd wordpress-deploygit initStep 2: Understanding WordPress Requirements
WordPress requires the following to run successfully:
- PHP: Version 7.4 or higher (8.0+ recommended)
- Web Server: Apache or Nginx
- Database: MySQL 5.7+ or MariaDB 10.3+
- PHP Extensions: mysqli, curl, gd, mbstring, xml, zip, openssl
- Storage: Persistent storage for wp-content directory
- Memory: Minimum 256MB PHP memory limit (512MB recommended)
Deploying with a Dockerfile
Klutch.sh automatically detects a Dockerfile in your repository’s root directory and uses it to build your application. This approach provides reproducible builds, full control over dependencies, and consistency across environments.
Sample Dockerfile for WordPress
Create a Dockerfile in your repository root with the following content:
FROM wordpress:6.6-php8.2-apache
# Install additional PHP extensions if neededRUN apt-get update && apt-get install -y \ libzip-dev \ zip \ unzip \ && docker-php-ext-install zip \ && rm -rf /var/lib/apt/lists/*
# Configure PHP settingsRUN echo "upload_max_filesize = 64M" > /usr/local/etc/php/conf.d/uploads.ini \ && echo "post_max_size = 64M" >> /usr/local/etc/php/conf.d/uploads.ini \ && echo "memory_limit = 512M" >> /usr/local/etc/php/conf.d/uploads.ini \ && echo "max_execution_time = 300" >> /usr/local/etc/php/conf.d/uploads.ini
# Enable Apache modulesRUN a2enmod rewrite expires headers
# Set working directoryWORKDIR /var/www/html
# WordPress runs on port 80 internallyEXPOSE 80
# Health checkHEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \ CMD curl -f http://localhost/ || exit 1
# The base image already has an entrypoint configured# This starts Apache with WordPressThis Dockerfile uses the official wordpress:6.6-php8.2-apache image, which includes:
- WordPress core files pre-installed
- Apache web server configured for WordPress
- PHP 8.2 with necessary extensions
- Automatic wp-config.php generation from environment variables
- Support for WordPress CLI (wp-cli)
Alternative: Custom WordPress Installation
If you need more control or want to customize the WordPress installation, use this alternative Dockerfile:
FROM php:8.2-apache
# Install system dependencies and PHP extensionsRUN apt-get update && apt-get install -y \ libpng-dev \ libjpeg-dev \ libfreetype6-dev \ libzip-dev \ libonig-dev \ libxml2-dev \ libwebp-dev \ zip \ unzip \ curl \ && docker-php-ext-configure gd --with-freetype --with-jpeg --with-webp \ && docker-php-ext-install -j$(nproc) \ gd \ mysqli \ pdo_mysql \ zip \ opcache \ exif \ mbstring \ && rm -rf /var/lib/apt/lists/*
# Configure PHP for WordPressRUN { \ echo 'upload_max_filesize = 64M'; \ echo 'post_max_size = 64M'; \ echo 'memory_limit = 512M'; \ echo 'max_execution_time = 300'; \ echo 'max_input_time = 300'; \ } > /usr/local/etc/php/conf.d/wordpress.ini
# Configure OPcache for better performanceRUN { \ echo 'opcache.enable=1'; \ echo 'opcache.memory_consumption=128'; \ echo 'opcache.interned_strings_buffer=8'; \ echo 'opcache.max_accelerated_files=4000'; \ echo 'opcache.revalidate_freq=2'; \ echo 'opcache.fast_shutdown=1'; \ } > /usr/local/etc/php/conf.d/opcache.ini
# Enable Apache modulesRUN a2enmod rewrite expires headers deflate
# Download and install WordPressENV WORDPRESS_VERSION 6.6RUN curl -o wordpress.tar.gz -fSL "https://wordpress.org/wordpress-${WORDPRESS_VERSION}.tar.gz" \ && tar -xzf wordpress.tar.gz -C /var/www/html --strip-components=1 \ && rm wordpress.tar.gz \ && chown -R www-data:www-data /var/www/html
# Set working directoryWORKDIR /var/www/html
EXPOSE 80
CMD ["apache2-foreground"]Custom wp-config.php (Optional)
For advanced configurations, you can create a custom wp-config.php. However, the official WordPress Docker image automatically generates this from environment variables, which is recommended for containerized deployments.
Step-by-Step Deployment on Klutch.sh
1. Push Your Repository to GitHub
-
Commit your
Dockerfileto your repository:Terminal window git add Dockerfilegit commit -m "Add WordPress Dockerfile for Klutch.sh deployment"git push origin main
2. Create a New App on Klutch.sh
-
Log in to the Klutch.sh dashboard
-
Create a new project or select an existing one
-
Create a new app and configure it:
- Repository: Select your WordPress GitHub repository
- Branch: Choose the branch to deploy (e.g.,
mainorproduction) - Traffic Type: Select HTTP (WordPress is a web application)
- Internal Port: Set to 80 (Apache’s default port)
3. Configure Persistent Volumes
WordPress requires persistent storage for themes, plugins, and uploaded media. Set up a volume in your app configuration:
-
In your app settings, navigate to the Volumes section
-
Add a volume with the following configuration:
- Mount Path:
/var/www/html/wp-content - Size: Start with 10GB, scale based on expected media usage
- Mount Path:
Storage Recommendations by Site Type:
- Personal Blog: 5-10GB (minimal media, few plugins)
- Business Website: 10-25GB (moderate media, several plugins/themes)
- Media-Heavy Site: 50-100GB (photography, video content)
- E-commerce Store: 25-100GB (product images, multiple plugins)
- Enterprise/Multi-author: 100GB+ (extensive content, many plugins)
Important: When configuring volumes on Klutch.sh, you only specify the mount path and size. The platform handles volume naming and management automatically.
4. Set Environment Variables
Configure the required environment variables for WordPress to connect to your database:
-
In your app settings, navigate to the Environment Variables section
-
Add the following required variables (mark sensitive values as secrets):
Database Configuration:
Terminal window # MySQL/MariaDB connection detailsWORDPRESS_DB_HOST=mysql-app.klutch.sh:8000WORDPRESS_DB_NAME=wordpressWORDPRESS_DB_USER=wordpress_userWORDPRESS_DB_PASSWORD=your-secure-passwordWordPress Configuration:
Terminal window # Table prefix (default: wp_)WORDPRESS_TABLE_PREFIX=wp_# Debug mode (set to false in production)WORDPRESS_DEBUG=false# Memory limitsWP_MEMORY_LIMIT=256MWP_MAX_MEMORY_LIMIT=512MOptional - Advanced Configuration:
Terminal window # Disable file editing from admin panel (security)WORDPRESS_CONFIG_EXTRA="define('DISALLOW_FILE_EDIT', true);"# Force SSL admin (if using custom domain with HTTPS)FORCE_SSL_ADMIN=true# Automatic core updatesAUTOMATIC_UPDATER_DISABLED=false
Security Note: Always mark WORDPRESS_DB_PASSWORD and any API keys as secrets in Klutch.sh to prevent them from appearing in logs or being exposed.
5. Configure Additional Settings
-
Region: Choose a region closest to your target audience for optimal performance
-
Compute: Select an instance size based on your expected traffic:
- Small (1 CPU, 1GB RAM): Personal blog or low-traffic site (up to 1,000 monthly visitors)
- Medium (2 CPU, 2GB RAM): Small business site (1,000-10,000 monthly visitors)
- Large (4 CPU, 4GB RAM): Medium traffic or e-commerce (10,000-50,000 monthly visitors)
- XLarge (8 CPU, 8GB RAM): High-traffic or resource-intensive sites (50,000+ monthly visitors)
-
Instances: Start with 1 instance (multiple instances require additional configuration for shared sessions and file storage)
6. Deploy Your Application
-
Review your configuration settings
-
Click “Create” to start the deployment
-
Klutch.sh will:
- Detect your Dockerfile automatically
- Build your Docker image
- Deploy the container with your configured volumes and environment variables
- Route HTTP traffic to port 80 inside your container
- Generate a public URL like
example-app.klutch.sh
-
Monitor the build and deployment progress in the dashboard
-
Wait for the deployment to complete (initial deployment typically takes 2-5 minutes)
7. Complete WordPress Installation
-
Once deployment is complete, visit your app URL (e.g.,
https://example-app.klutch.sh) -
Complete the WordPress installation wizard:
- Language: Select your preferred language
- Site Title: Enter your website name
- Username: Create an admin username (avoid “admin” for security)
- Password: Use a strong password (WordPress will suggest one)
- Email: Enter your admin email address
- Search Engine Visibility: Check this to discourage search engines during development
-
Click “Install WordPress”
-
Log in with your admin credentials
-
You’re now ready to customize your site!
Database Setup and Configuration
WordPress requires MySQL or MariaDB for storing all content and configuration.
Option 1: Deploy MySQL on Klutch.sh (Recommended)
Deploy a MySQL database as a separate app on Klutch.sh:
- Create a new app with the MySQL Docker image
- Configure it with TCP traffic type (not HTTP)
- Set internal port to 5432 for PostgreSQL or 3306 for MySQL
- Set up persistent storage at
/var/lib/mysql(minimum 10GB for MySQL) - Configure environment variables for database credentials
- Note the app URL (e.g.,
mysql-app.klutch.sh) - Use
mysql-app.klutch.sh:8000as yourWORDPRESS_DB_HOST
See our MySQL deployment guide or MariaDB deployment guide for detailed instructions.
Option 2: Use a Managed Database Service
For production deployments with high availability requirements, consider managed database services:
- Amazon RDS for MySQL
- Google Cloud SQL for MySQL
- DigitalOcean Managed MySQL
- PlanetScale (MySQL-compatible)
These services provide automatic backups, point-in-time recovery, high availability, and simplified maintenance.
Database Initialization
WordPress will automatically create the necessary database tables on first installation. The initial database schema includes tables for:
- Posts and pages
- Users and user metadata
- Comments
- Options (site settings)
- Taxonomy (categories and tags)
- Links and navigation menus
- Post metadata
Initial Database Size: Start with 5-10GB and monitor growth. Active sites can grow significantly over time with content and metadata.
Theme and Plugin Management
Installing Themes
Method 1: From WordPress Admin Dashboard
- Navigate to Appearance > Themes in the admin dashboard
- Click “Add New”
- Browse or search for themes
- Click “Install” then “Activate”
Method 2: Upload Custom Theme
- Navigate to Appearance > Themes > Add New > Upload Theme
- Choose your theme ZIP file
- Click “Install Now” then “Activate”
Method 3: Via Dockerfile (Recommended for Custom Themes)
Add to your Dockerfile:
FROM wordpress:6.6-php8.2-apache
# Copy custom themeCOPY ./themes/my-custom-theme /var/www/html/wp-content/themes/my-custom-theme
# Set proper permissionsRUN chown -R www-data:www-data /var/www/html/wp-content/themes
EXPOSE 80Installing Plugins
Method 1: From WordPress Admin Dashboard
- Navigate to Plugins > Add New
- Browse or search for plugins
- Click “Install Now” then “Activate”
Method 2: Via Dockerfile (Recommended for Required Plugins)
Add to your Dockerfile:
FROM wordpress:6.6-php8.2-apache
# Install WordPress CLIRUN curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar \ && chmod +x wp-cli.phar \ && mv wp-cli.phar /usr/local/bin/wp
# Install required plugins (run after WordPress is set up)# This is typically done through a startup scriptCOPY install-plugins.sh /usr/local/bin/RUN chmod +x /usr/local/bin/install-plugins.sh
EXPOSE 80install-plugins.sh:
#!/bin/bash# Wait for WordPress to be readysleep 10
# Install and activate pluginswp plugin install wordfence --activate --allow-rootwp plugin install wp-super-cache --activate --allow-rootwp plugin install contact-form-7 --activate --allow-rootEssential Plugins for Production
Security:
- Wordfence Security - Firewall and malware scanner
- All In One WP Security - Security hardening
Performance:
- WP Super Cache - Static page caching
- Autoptimize - CSS/JS optimization
- Imagify - Image optimization
SEO:
- Yoast SEO - Comprehensive SEO toolkit
- XML Sitemaps - Sitemap generation
Backups:
- UpdraftPlus - Automated backups
- BackWPup - Complete backup solution
Forms:
- Contact Form 7 - Form builder
- WPForms - Drag-and-drop forms
Content Management
Creating Posts and Pages
Posts are for blog content (news, articles) and appear in reverse chronological order:
- Navigate to Posts > Add New
- Enter title and content using the block editor
- Set categories and tags
- Configure excerpt and featured image
- Click “Publish”
Pages are for static content (About, Contact, Services):
- Navigate to Pages > Add New
- Enter title and content
- Choose page template (if your theme provides options)
- Set parent page if creating a hierarchy
- Click “Publish”
Media Management
Upload and manage images, videos, and documents:
- Navigate to Media > Library
- Click “Add New” to upload files
- Drag and drop multiple files
- Edit metadata (title, alt text, description)
- Organize with media folders (requires plugin)
Best Practices:
- Optimize images before upload (use tools like TinyPNG)
- Use descriptive filenames (helps with SEO)
- Add alt text to all images (accessibility and SEO)
- Recommended image sizes: max 2000px width, under 200KB
- Use appropriate formats (JPEG for photos, PNG for graphics, WebP for modern browsers)
Navigation Menus
Create custom navigation menus:
- Navigate to Appearance > Menus
- Create a new menu or edit existing
- Add pages, posts, custom links, or categories
- Drag and drop to reorganize
- Create sub-menus by indenting items
- Assign menu to theme location (header, footer, etc.)
- Click “Save Menu”
Security Best Practices
Authentication and Access Control
-
Strong Admin Credentials:
- Use unique username (avoid “admin”)
- Enable strong passwords (minimum 12 characters)
- Change passwords regularly
-
User Role Management:
- Create users with appropriate roles (Administrator, Editor, Author, Contributor, Subscriber)
- Grant least privileges necessary
- Remove unused accounts
-
Two-Factor Authentication:
- Install plugin like Two Factor Authentication
- Require 2FA for admin accounts
-
Limit Login Attempts:
- Install Limit Login Attempts Reloaded
- Configure lockout thresholds
WordPress Hardening
-
Disable File Editing:
Add to your environment variables:
Terminal window WORDPRESS_CONFIG_EXTRA="define('DISALLOW_FILE_EDIT', true);" -
Hide WordPress Version:
Add to functions.php in your theme:
remove_action('wp_head', 'wp_generator'); -
Disable XML-RPC (if not needed):
Add to .htaccess:
<Files xmlrpc.php>Order Allow,DenyDeny from all</Files> -
Protect wp-config.php:
Add to .htaccess:
<Files wp-config.php>Order Allow,DenyDeny from all</Files> -
Security Headers:
Add to your Apache configuration or .htaccess:
Header set X-Content-Type-Options "nosniff"Header set X-Frame-Options "SAMEORIGIN"Header set X-XSS-Protection "1; mode=block"Header set Referrer-Policy "strict-origin-when-cross-origin"
Regular Maintenance
-
Keep WordPress Updated:
- Enable automatic core updates
- Update plugins and themes regularly
- Test updates in staging environment first
-
Install Security Plugin:
- Use Wordfence or similar
- Configure firewall rules
- Enable malware scanning
- Set up email alerts
-
Regular Backups:
- Database: Daily backups
- Files (wp-content): Weekly backups
- Store backups off-site
- Test restore procedures
-
Monitor Activity:
- Install activity log plugin
- Monitor failed login attempts
- Review user activity
- Check for suspicious files
Performance Optimization
Caching Strategy
-
Page Caching:
- Install WP Super Cache or W3 Total Cache
- Enable page caching for logged-out users
- Configure cache expiration (24 hours recommended)
-
Object Caching:
- Use Redis or Memcached for object caching
- Install Redis Object Cache plugin
- Configure persistent connection
-
Opcode Caching:
- Included in our Dockerfile with OPcache
- Caches compiled PHP bytecode
- Reduces server load significantly
Database Optimization
-
Clean Up Database:
- Install WP-Optimize plugin
- Remove post revisions regularly
- Delete spam comments
- Clean transients and expired options
-
Optimize Tables:
OPTIMIZE TABLE wp_posts, wp_postmeta, wp_options; -
Limit Post Revisions:
Add to wp-config.php via environment variables:
Terminal window WORDPRESS_CONFIG_EXTRA="define('WP_POST_REVISIONS', 5);"
Content Delivery
-
Image Optimization:
- Install Imagify or ShortPixel
- Enable automatic compression
- Serve images in WebP format
- Lazy load images below the fold
-
CSS/JS Optimization:
- Install Autoptimize plugin
- Minify CSS and JavaScript
- Combine files when possible
- Defer non-critical CSS/JS
-
CDN Integration:
- Use Cloudflare, StackPath, or similar
- Configure WordPress to use CDN URLs
- Cache static assets globally
- Enable Brotli compression
Performance Monitoring
-
Monitor Page Speed:
- Use Google PageSpeed Insights
- Target 90+ score for mobile and desktop
- Monitor Core Web Vitals
-
Database Query Monitoring:
- Install Query Monitor plugin
- Identify slow queries
- Optimize problematic queries
-
Server Resource Usage:
- Monitor CPU and memory usage in Klutch.sh dashboard
- Scale resources if consistently high
- Review error logs for issues
Backup and Disaster Recovery
Automated Backup Strategy
-
Database Backups:
Using UpdraftPlus or similar:
- Schedule: Daily for database
- Retention: 30 days
- Storage: Remote (S3, Google Drive, Dropbox)
-
File Backups:
- Schedule: Weekly for wp-content
- Retention: 4 weeks
- Include themes, plugins, and uploads
-
Backup Script Example:
#!/bin/bash# Database backupmysqldump -h mysql-app.klutch.sh -P 8000 -u wordpress_user -p'password' wordpress > backup-$(date +%Y%m%d).sql# Compress and upload to S3gzip backup-$(date +%Y%m%d).sqlaws s3 cp backup-$(date +%Y%m%d).sql.gz s3://your-bucket/wordpress-backups/# Clean up old backups (keep 30 days)find . -name "backup-*.sql.gz" -mtime +30 -delete
Disaster Recovery Plan
-
Document Your Configuration:
- List all active plugins and themes
- Document custom code modifications
- Save copies of configuration files
- Keep environment variables documented
-
Test Restore Procedures:
- Practice restoring from backup monthly
- Verify database integrity
- Test site functionality after restore
-
Emergency Contacts:
- Maintain list of key personnel
- Document hosting provider support contacts
- Keep WordPress community resources handy
Troubleshooting Common Issues
Site Not Loading
Problem: White screen or 500 error after deployment
Solutions:
-
Check database connection:
- Verify
WORDPRESS_DB_HOSTincludes port (:8000) - Test database connectivity
- Confirm credentials are correct
- Verify
-
Review container logs in Klutch.sh dashboard:
Terminal window # Look for PHP errorstail -f /var/log/apache2/error.log -
Increase PHP memory limit:
Terminal window WP_MEMORY_LIMIT=512M -
Check file permissions:
Terminal window chown -R www-data:www-data /var/www/html
Upload Errors
Problem: “Unable to create directory” or upload fails
Solutions:
-
Verify persistent volume is mounted at
/var/www/html/wp-content -
Check disk space:
- Monitor volume usage in Klutch.sh dashboard
- Increase volume size if near capacity
-
Verify file size limits in Dockerfile:
RUN echo "upload_max_filesize = 64M" > /usr/local/etc/php/conf.d/uploads.ini \&& echo "post_max_size = 64M" >> /usr/local/etc/php/conf.d/uploads.ini -
Check file permissions:
Terminal window chmod 755 /var/www/html/wp-content/uploads
Plugin/Theme Installation Fails
Problem: Cannot install or update plugins/themes
Solutions:
-
Verify write permissions to wp-content
-
Check available disk space
-
Disable conflicting plugins
-
Install via WP-CLI as workaround:
Terminal window wp plugin install plugin-name --activate
Performance Issues
Problem: Slow page load times
Solutions:
-
Enable Caching:
- Install and configure WP Super Cache
- Enable browser caching in .htaccess
-
Optimize Database:
- Run WP-Optimize to clean database
- Remove unused plugins and themes
-
Check Resource Usage:
- Review CPU/memory in Klutch.sh dashboard
- Scale to larger instance if needed
-
Analyze Slow Queries:
- Install Query Monitor plugin
- Identify and optimize slow database queries
-
Enable CDN:
- Use Cloudflare or similar
- Offload static assets
Database Connection Errors
Problem: “Error establishing database connection”
Solutions:
-
Verify environment variables:
Terminal window WORDPRESS_DB_HOST=mysql-app.klutch.sh:8000WORDPRESS_DB_NAME=wordpressWORDPRESS_DB_USER=wordpress_userWORDPRESS_DB_PASSWORD=correct-password -
Test database connectivity:
Terminal window mysql -h mysql-app.klutch.sh -P 8000 -u wordpress_user -p -
Check MySQL service status
-
Verify firewall rules allow connection between apps
404 Errors on Permalinks
Problem: Posts/pages show 404 errors
Solutions:
-
Ensure mod_rewrite is enabled (included in our Dockerfile)
-
Regenerate permalinks:
- Go to Settings > Permalinks
- Click “Save Changes” without changing anything
-
Check .htaccess file exists and is writable:
# BEGIN WordPress<IfModule mod_rewrite.c>RewriteEngine OnRewriteBase /RewriteRule ^index\.php$ - [L]RewriteCond %{REQUEST_FILENAME} !-fRewriteCond %{REQUEST_FILENAME} !-dRewriteRule . /index.php [L]</IfModule># END WordPress
Production Deployment Checklist
Before launching your WordPress site:
- MySQL database deployed with automated backups
- Persistent volume configured at
/var/www/html/wp-contentwith adequate size - All environment variables set (especially database credentials marked as secrets)
- Strong admin username and password configured
- Unnecessary default plugins removed
- Security plugin installed and configured (Wordfence or similar)
- SSL/HTTPS enabled (automatic with Klutch.sh)
- Custom domain configured (optional)
- Permalink structure set (e.g.,
/%postname%/) - XML-RPC disabled (if not needed)
- File editing disabled in admin panel
- Two-factor authentication enabled for admin accounts
- Backup plugin installed and configured
- Caching plugin installed and configured
- Image optimization plugin installed
- SEO plugin installed and configured (Yoast SEO)
- Google Analytics or similar tracking installed
- Contact forms tested
- Email functionality tested
- Performance optimized (page speed 90+ score)
- Mobile responsiveness verified
- Browser compatibility tested
- Search functionality tested
- 404 page customized
- Robots.txt configured
- Sitemap generated and submitted to search engines
- Social media meta tags configured
- Legal pages created (Privacy Policy, Terms of Service)
- Staging environment created for testing updates
- Monitoring and uptime alerts configured
- Documentation created for site maintenance
Advanced Configuration
Custom Domain Setup
To use a custom domain with your WordPress deployment:
-
Configure your custom domain in the Klutch.sh dashboard (see Custom Domains Guide)
-
Update your DNS records to point to your Klutch.sh app
-
Update WordPress site URL:
-
Navigate to Settings > General
-
Update WordPress Address (URL) and Site Address (URL)
-
Or add to environment variables:
Terminal window WORDPRESS_CONFIG_EXTRA="define('WP_HOME', 'https://yourdomain.com'); define('WP_SITEURL', 'https://yourdomain.com');"
-
-
Klutch.sh automatically manages TLS certificates for your domain
-
Set up 301 redirects from old domain if migrating
WordPress Multisite
To enable WordPress Multisite for managing multiple sites from one installation:
-
Add to environment variables:
Terminal window WORDPRESS_CONFIG_EXTRA="define('WP_ALLOW_MULTISITE', true);" -
After enabling, navigate to Tools > Network Setup
-
Choose subdomain or subdirectory installation
-
Update environment variables with generated configuration
-
Configure wildcard DNS for subdomains (if using subdomain multisite)
WooCommerce for E-commerce
To add e-commerce functionality to WordPress:
-
Install WooCommerce plugin:
Terminal window wp plugin install woocommerce --activate -
Run the setup wizard to configure:
- Store details
- Payment gateways (Stripe, PayPal)
- Shipping options
- Tax rates
-
Configure persistent storage for product images
-
Set up automated backups for order data
-
Consider upgrading compute resources for better performance
See our WooCommerce deployment guide for detailed e-commerce setup.
Headless WordPress
Use WordPress as a headless CMS with the REST API:
-
Enable REST API (enabled by default)
-
Install JWT Authentication plugin:
Terminal window wp plugin install jwt-authentication-for-wp-rest-api --activate -
Configure CORS headers in .htaccess:
Header set Access-Control-Allow-Origin "*"Header set Access-Control-Allow-Methods "GET, POST, OPTIONS, DELETE, PUT" -
Access content via REST API:
Terminal window curl https://example-app.klutch.sh/wp-json/wp/v2/posts -
Build frontend with React, Vue, or Next.js consuming the WordPress API
Integration Examples
Google Analytics Integration
Add tracking to your WordPress site:
Method 1: Using Plugin
- Install MonsterInsights or Site Kit by Google
- Connect to your Google Analytics account
- Configure tracking options
Method 2: Manual Integration
Add to your theme’s header.php:
<!-- Google Analytics --><script async src="https://www.googletagmanager.com/gtag/js?id=GA_MEASUREMENT_ID"></script><script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'GA_MEASUREMENT_ID');</script>Social Media Integration
Add social sharing and feeds:
-
Install social sharing plugin like Social Warfare
-
Configure social meta tags (Open Graph, Twitter Cards):
- Install Yoast SEO (includes social meta)
- Configure social profiles
- Set default social images
-
Embed social feeds:
- Instagram: Smash Balloon Instagram Feed
- Twitter: Custom Twitter Feeds
- Facebook: Custom Facebook Feed
Email Marketing Integration
Connect WordPress to email marketing platforms:
Mailchimp:
- Install MC4WP: Mailchimp for WordPress
- Connect with API key
- Add signup forms to site
ConvertKit:
- Install ConvertKit plugin
- Configure forms and automation
API Integration Example
Access WordPress content programmatically:
JavaScript/Node.js:
const fetch = require('node-fetch');
// Get recent postsasync function getRecentPosts() { const response = await fetch('https://example-app.klutch.sh/wp-json/wp/v2/posts?per_page=5'); const posts = await response.json();
posts.forEach(post => { console.log(`Title: ${post.title.rendered}`); console.log(`Link: ${post.link}`); console.log(`Excerpt: ${post.excerpt.rendered}\n`); });}
// Create a new post (requires authentication)async function createPost(title, content, token) { const response = await fetch('https://example-app.klutch.sh/wp-json/wp/v2/posts', { method: 'POST', headers: { 'Content-Type': 'application/json', 'Authorization': `Bearer ${token}` }, body: JSON.stringify({ title: title, content: content, status: 'publish' }) });
const post = await response.json(); console.log(`Created post: ${post.link}`);}
getRecentPosts();Python:
import requests
# Get recent postsresponse = requests.get('https://example-app.klutch.sh/wp-json/wp/v2/posts?per_page=5')posts = response.json()
for post in posts: print(f"Title: {post['title']['rendered']}") print(f"Link: {post['link']}") print(f"Excerpt: {post['excerpt']['rendered']}\n")
# Create a new post (requires authentication)def create_post(title, content, token): headers = { 'Content-Type': 'application/json', 'Authorization': f'Bearer {token}' }
data = { 'title': title, 'content': content, 'status': 'publish' }
response = requests.post( 'https://example-app.klutch.sh/wp-json/wp/v2/posts', headers=headers, json=data )
post = response.json() print(f"Created post: {post['link']}")Migration Guide
Migrating from Existing WordPress Site
To migrate an existing WordPress site to Klutch.sh:
-
Export Current Site:
- Install All-in-One WP Migration
- Export site (creates a .wpress file)
- Or manually export database and wp-content folder
-
Set Up New Klutch.sh Deployment:
- Deploy WordPress following this guide
- Complete initial WordPress installation
-
Import Data:
- Install All-in-One WP Migration on new site
- Import the .wpress file
- Or manually import database and upload wp-content files
-
Update Configuration:
- Update site URLs in database
- Regenerate permalinks
- Clear all caches
-
Update DNS:
- Point domain to new Klutch.sh deployment
- Monitor for issues after DNS propagation
-
Verify Migration:
- Test all pages and functionality
- Check forms, payment gateways, and integrations
- Verify media files are accessible
- Test user logins
Database URL Updates
After migration, update URLs in database:
-- Update site URLUPDATE wp_options SET option_value = 'https://example-app.klutch.sh'WHERE option_name IN ('siteurl', 'home');
-- Update post content URLsUPDATE wp_posts SET post_content = REPLACE(post_content, 'oldsite.com', 'example-app.klutch.sh');
-- Update post metadata URLsUPDATE wp_postmeta SET meta_value = REPLACE(meta_value, 'oldsite.com', 'example-app.klutch.sh');Or use WP-CLI:
wp search-replace 'oldsite.com' 'example-app.klutch.sh' --all-tablesResources and Further Reading
- WordPress Official Website
- WordPress Documentation
- WordPress Developer Resources
- WordPress Codex
- WordPress Docker Hub
- WordPress Plugin Directory
- WordPress Theme Directory
- Make WordPress (Community)
- WordPress Learn
- WP Multisite Tutorials
- Klutch.sh Quick Start Guide
- Klutch.sh Volumes Documentation
- Klutch.sh Custom Domains Guide
- MySQL Deployment Guide
- MariaDB Deployment Guide
Conclusion
Deploying WordPress on Klutch.sh provides a robust, scalable solution for building and managing websites of any size. With automatic Docker detection, persistent storage for media and custom code, seamless database integration, and built-in SSL/TLS, you can focus on creating great content while Klutch.sh handles the infrastructure complexity.
This guide covered everything from basic deployment to advanced configuration, security best practices, performance optimization, troubleshooting, and integrations. Whether you’re launching a personal blog, building a business website, setting up an online store, or creating a custom web application, WordPress on Klutch.sh offers the flexibility, features, and reliability you need to succeed online.
With WordPress’s vast ecosystem of themes and plugins, combined with Klutch.sh’s simplified deployment and scaling capabilities, you have everything you need to build a professional web presence. The platform’s automatic updates, persistent storage, and easy database management mean you can spend less time on server maintenance and more time on what matters - creating and publishing great content.
For additional help or questions, refer to the resources above or reach out to the WordPress community and Klutch.sh support team.