A customized WordPress Docker image with configurable PHP upload limits and optimized settings for larger file uploads.
- 🚀 Based on the official WordPress Docker image
- 📁 Configurable file upload limits via environment variables
- ⚡ Optimized PHP settings for better performance
- 🔧 Runtime configuration without rebuilding the image
- 📋 Custom .htaccess support
# Run with default settings (512MB upload limit)
docker run -d \
--name my-wordpress \
-p 8080:80 \
your-wordpress-image
# Run with custom upload limits
docker run -d \
--name my-wordpress \
-p 8080:80 \
-e UPLOAD_MAX_FILESIZE=1G \
-e POST_MAX_SIZE=1G \
-e MEMORY_LIMIT=1G \
your-wordpress-image
Create a docker-compose.yml
file:
version: '3.8'
services:
wordpress:
build: .
ports:
- "8080:80"
environment:
# Database connection
WORDPRESS_DB_HOST: db:3306
WORDPRESS_DB_USER: wordpress
WORDPRESS_DB_PASSWORD: wordpress
WORDPRESS_DB_NAME: wordpress
# Upload configuration
UPLOAD_MAX_FILESIZE: 1G
POST_MAX_SIZE: 1G
MEMORY_LIMIT: 1G
MAX_EXECUTION_TIME: 600
MAX_INPUT_TIME: 600
volumes:
- wordpress_data:/var/www/html
depends_on:
- db
db:
image: mysql:8.0
environment:
MYSQL_DATABASE: wordpress
MYSQL_USER: wordpress
MYSQL_PASSWORD: wordpress
MYSQL_ROOT_PASSWORD: rootpassword
volumes:
- db_data:/var/lib/mysql
volumes:
wordpress_data:
db_data:
Then run:
docker-compose up -d
Variable | Default | Description |
---|---|---|
UPLOAD_MAX_FILESIZE |
512M |
Maximum file upload size |
POST_MAX_SIZE |
512M |
Maximum POST data size (should be >= upload_max_filesize) |
MEMORY_LIMIT |
512M |
PHP memory limit |
MAX_EXECUTION_TIME |
300 |
Maximum script execution time in seconds |
MAX_INPUT_TIME |
300 |
Maximum input parsing time in seconds |
2M
- 2 Megabytes64M
- 64 Megabytes512M
- 512 Megabytes (default)1G
- 1 Gigabyte2G
- 2 Gigabytes
environment:
UPLOAD_MAX_FILESIZE: 64M
POST_MAX_SIZE: 64M
MEMORY_LIMIT: 256M
environment:
UPLOAD_MAX_FILESIZE: 1G
POST_MAX_SIZE: 1G
MEMORY_LIMIT: 1G
MAX_EXECUTION_TIME: 600
environment:
UPLOAD_MAX_FILESIZE: 2G
POST_MAX_SIZE: 2G
MEMORY_LIMIT: 2G
MAX_EXECUTION_TIME: 900
MAX_INPUT_TIME: 900
To build the Docker image yourself:
# Clone the repository
git clone <your-repo-url>
cd coolify-wordpress
# Build the image
docker build -t my-wordpress .
# Run the container
docker run -d -p 8080:80 my-wordpress
After starting your container, you can verify the upload limits:
-
Via WordPress Admin:
- Go to Media → Add New
- Check the maximum upload file size displayed
-
Via PHP Info (temporary):
- Create a PHP file with
<?php phpinfo(); ?>
- Look for
upload_max_filesize
,post_max_size
, andmemory_limit
- Create a PHP file with
-
Via Container Logs:
docker logs your-container-name
If uploads are still limited after configuration:
- Check WordPress
wp-config.php
- Some plugins may override PHP settings - Verify environment variables:
docker exec your-container-name env | grep UPLOAD
- Check PHP configuration:
docker exec your-container-name cat /usr/local/etc/php/conf.d/uploads.ini
If you encounter memory errors:
- Increase
MEMORY_LIMIT
- Consider increasing
MAX_EXECUTION_TIME
for large file processing
Note that some reverse proxies (nginx, Apache) may have their own upload limits that need to be configured separately.
├── Dockerfile # Main Docker configuration
├── custom.htaccess # Custom Apache configuration
├── coolify.json # Coolify deployment configuration
└── README.md # This file
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.
For issues and questions:
- Open an issue on GitHub
- Check WordPress documentation for WordPress-specific problems
- Review Docker logs for container-related issues