[Docker] WordPress on Synology NAS via Docker (Manual Installation)

Learn how to manually install WordPress on Synology NAS using Docker Compose with PHP-FPM, Nginx, Redis, and phpMyAdmin. Step-by-step tutorial for a powerful, optimized WordPress setup.

[Docker] WordPress on Synology NAS via Docker (Manual Installation)

Setting up WordPress on a Synology NAS can be as easy or as powerful as you want it to be. If you’re just blogging casually, Synology’s built-in WordPress package will get you started in minutes. But if you plan to scale, customize deeply, or squeeze every ounce of performance out of your hardware, the Docker method is a game-changer.

In this guide, you’ll learn how to manually install WordPress with PHP-FPM + Nginx, Redis (phpredis), and phpMyAdmin on your Synology NAS using Docker Compose. This method provides more flexibility, easier maintenance, and performance benefits that outshine the default Synology package installation.


Why Use Docker for WordPress on Synology NAS

Before diving into the steps, let’s understand why this setup is worth your effort.

Running WordPress in Docker containers allows you to:

  • Isolate components (WordPress, database, Redis, etc.) for easier debugging and upgrading.
  • Customize configurations (PHP settings, caching, reverse proxy) without affecting the entire NAS.
  • Improve performance using Redis caching and Nginx as a fast reverse proxy.
  • Simplify backups and migrations — containers can be moved or replicated easily.
  • Avoid Synology package limitations, such as outdated PHP versions or fixed directory structures.

In short, Docker gives you control and scalability that the one-click installer never could.


Step 1: Prepare Your Synology NAS Environment

Before installing anything, ensure your NAS is ready for Docker.

  1. Enable Docker:
    • Go to Package Center → Search “Docker” → Install.
    • If you’re using DSM 7.x, it may appear as Container Manager instead.
  2. Create Folders for WordPress and Database:
    • In File Station, create:
      • /volume1/docker/wordpress/html
      • /volume1/docker/wordpress/mariadb
  3. Adjust Permissions:
    • Grant read/write permissions for the docker user and your main admin account.
    • This ensures WordPress can save files, themes, and uploads properly.

Step 2: Write the Docker Compose File

Here’s the heart of the setup — your docker-compose.yml file.
This defines the services (WordPress, MariaDB, Redis, phpMyAdmin) and how they connect.

services:
  # ── MariaDB database for WordPress ─────────────────────
  db:
    image: mariadb:11.4
    container_name: mariadb
    environment:
      MARIADB_ROOT_PASSWORD: "YOURPASSWORD"   # ⚠️ Change to strong password
      MARIADB_DATABASE: "wordpress"
      MARIADB_USER: "wordpress"
      MARIADB_PASSWORD: "YOURPASSWORD"        # ⚠️ Same as above
    volumes:
      - /volume1/docker/wordpress/mariadb:/var/lib/mysql   # DB data folder
    restart: unless-stopped
    networks:
      - wp-net

  # ── WordPress application ──────────────────────────────
  wp:
    image: wordpress:latest
    container_name: wordpress
    depends_on:
      - db
    ports:
      - "8098:80"                              # Access via http://NAS-IP:8098
    environment:
      WORDPRESS_DB_HOST: "db:3306"
      WORDPRESS_DB_NAME: "wordpress"
      WORDPRESS_DB_USER: "wordpress"
      WORDPRESS_DB_PASSWORD: "YOURPASSWORD"    # Must match DB password
    volumes:
      - /volume1/docker/wordpress/html:/var/www/html   # WP files folder
    restart: unless-stopped
    networks:
      - wp-net

networks:
  wp-net:
    driver: bridge

Once saved, upload the file to your Synology NAS (for example, /volume1/docker/wordpress/docker-compose.yml).

Then, open Container Manager → Projects → Add and select this file to deploy.


Step 3: Deploy and Access WordPress

When you start the project:

  • The database container (mariadb) initializes first.
  • Then WordPress (wp) connects to it using environment variables.

To access WordPress:

  • Open your browser and visit http://NAS-IP:8098
  • Follow the setup wizard: set your language, site name, admin credentials, and you’re ready to go.

⚠️ Important: Wait 3–5 minutes after starting the containers before accessing WordPress. The database needs a few moments to initialize. If you rush, you may see a “Database connection error.”


Step 4: Configure Reverse Proxy and Subdomain

For a professional setup, create a subdomain like blog.yourdomain.com and use Synology’s reverse proxy:

  1. Go to Control Panel → Login Portal → Reverse Proxy.
  2. Add a new rule:
    • Source: blog.yourdomain.com
    • Destination: localhost:8098
  3. Apply and test by visiting your subdomain.

You now have a clean URL without ports — much better for SEO and user experience.


Step 5: Fix Image Upload and Editing Issues

Sometimes, WordPress on Docker can fail to process or resize images properly due to PHP limitations. To fix this, edit your wp-config.php and add:

define('WP_IMAGE_EDITORS', array('WP_Image_Editor_GD','WP_Image_Editor_Imagick'));
define('WP_MEMORY_LIMIT', '512M');
define('WP_MAX_MEMORY_LIMIT', '512M');

This increases available memory and ensures both GD and Imagick libraries are used for image manipulation.
If you still face issues, check that your PHP container includes imagick — you might need to install it manually in advanced setups.


Step 6: Increase PHP Limits for Better Performance

To handle larger uploads or heavy themes, increase PHP limits.

  1. Restart the container.

Mount this file inside the container by editing your docker-compose.yml:

volumes:
  - /volume1/docker/wordpress/html:/var/www/html
  - /volume1/docker/wordpress/custom.ini:/usr/local/etc/php/conf.d/custom.ini

Create a file named custom.ini on your NAS:

max_execution_time = 300
max_input_time = 300
memory_limit = 512M
upload_max_filesize = 64M
post_max_size = 64M

These changes resolve most upload and theme preset loading issues.


Redis speeds up WordPress dramatically by storing frequently used queries in memory.

Add this service to your docker-compose.yml:

redis:
  image: redis:latest
  container_name: redis
  restart: unless-stopped
  networks:
    - wp-net

Then, install the Redis Object Cache plugin inside WordPress and connect it using host redis and port 6379.

You’ll see instant improvements in loading speed, especially for admin pages.


Step 8: Manage with phpMyAdmin

To make database management easier, add phpMyAdmin to your stack:

phpmyadmin:
  image: phpmyadmin:latest
  container_name: phpmyadmin
  environment:
    PMA_HOST: db
  ports:
    - "8099:80"
  restart: unless-stopped
  networks:
    - wp-net

Access it via http://NAS-IP:8099 and log in using the same database credentials from your WordPress environment.


Step 9: Backup and Maintenance

Docker makes it simple to back up your WordPress environment.
Just back up the mounted volumes:

  • /volume1/docker/wordpress/html
  • /volume1/docker/wordpress/mariadb

You can zip them manually or schedule a task using Synology Hyper Backup.


FAQs

1. Why use Docker instead of Synology’s WordPress package?
Because Docker offers better performance, flexibility, and control over your environment. The Synology package is limited in PHP versions and update cycles.

2. Do I need to install Nginx manually?
No. The WordPress Docker image includes an Apache server by default, but you can switch to PHP-FPM + Nginx for advanced performance setups.

3. Can I use Let’s Encrypt SSL with this setup?
Yes, via Synology’s Control Panel → Security → Certificates. Then apply it to your reverse proxy domain.

4. How do I update WordPress or MariaDB?
Simply pull the latest Docker images and restart the containers. Your data is stored persistently in mounted volumes.

5. What if I get a database connection error?
Wait a few minutes after starting containers — MariaDB may still be initializing. Check logs if the issue persists.

6. Is this method safe for production?
Yes, if you use strong passwords, SSL certificates, and regular backups. Many small and medium-sized sites use similar setups in production.


Conclusion

By following this guide, you’ve built a robust, high-performance WordPress installation on Synology NAS using Docker — complete with Redis caching, phpMyAdmin, and custom PHP configurations. This setup gives you flexibility, stability, and control that Synology’s one-click installer simply can’t match.

If you ever want to tweak your stack — maybe add Nginx as a front-end proxy, or integrate Cloudflare caching — you’ll have a modular foundation ready for it.


External Resource:
For more Docker and NAS tutorials, check out Docker Documentation.