Step by Step Guide on How to Setup Redis Cache on Ghost (Unraid)
嗯,用户让我帮忙总结一下这篇文章的内容,控制在一百个字以内,而且不需要用“文章内容总结”或者“这篇文章”这样的开头。直接写描述就行。好的,我先看看文章讲的是什么。 文章主要讲的是如何在Unraid Docker环境中设置Redis缓存到Ghost博客上。分了七个步骤,从部署Redis容器到验证连接。每个步骤都有详细的配置说明,比如设置容器端口、挂载配置文件等。最后还提到设置后的效果,比如页面加载时间减少和数据库查询减少。 用户的需求是总结内容,所以我要抓住关键点:Redis缓存、Unraid Docker环境、Ghost博客优化。然后用简洁的语言表达出来,控制在100字以内。 可能需要注意的点是不要遗漏主要步骤和效果,但又要简短。所以大概可以这样组织语言:“本文详细介绍了在Unraid Docker环境中为Ghost博客部署Redis缓存的七步指南,包括容器配置、IP地址获取、缓存设置及验证等操作,以优化页面加载速度和减少数据库压力。” 这样应该符合用户的要求了。 </think> 本文详细介绍了在Unraid Docker环境中为Ghost博客部署Redis缓存的七步指南,包括容器配置、IP地址获取、缓存设置及验证等操作,以优化页面加载速度和减少数据库压力。 2025-12-17 16:40:18 Author: www.blackmoreops.com(查看原文) 阅读量:1 收藏

This step by step guide on how to setup Redis cache on Ghost covers deployment, configuration, and verification for Unraid Docker environments. Implementing Redis caching on Ghost dramatically improves page load times by storing frequently accessed content in memory.

Ghost CMS Step by Step Guide on How to Setup Redis Cache on Ghost (Unraid)

Step 1: Deploy Redis Container

Before you can setup Redis cache for Ghost on your Unraid server, you need to install the Redis container! Navigate to the Docker tab in Unraid and click Add Container.

Configure these settings:

  • Name: Redis
  • Repository: redis:alpine
  • Network Type: Bridge
  • Container Port: 6379
  • Host Port: 6379

Click Apply to create the container.

Unraid Docker container configuration screen showing Redis setup

Step 2: Find Redis IP Address

Well, I guess you are not going to be able to setup Redis cache for Ghost if you can’t find the IP address of Redis and Ghost containers. To find those IP addresses, in Unraid terminal or SSH:

docker inspect Redis | grep IPAddress

Note the IP address (e.g., 172.17.0.14). You’ll need this for Ghost configuration.

Test Ghost to Redis connectivity:

docker exec -it Ghost bash

node -e "require('net').connect(6379, '172.17.0.14', () => console.log('Connected to Redis')).on('error', (e) => console.log('Error:', e.message))"
Connected to Redis

This should return “Connected to Redis“.

Finding Ghost and Redis IP and Network details and testing connections

Step 3: Create Ghost Configuration File

Navigate to Ghost appdata directory:

cd /mnt/user/appdata/ghost
nano config.production.json

Add this configuration:

{
  "url": "http://localhost:2368",
  "server": {
    "port": 2368,
    "host": "::"
  },
  "mail": {
    "transport": "Direct"
  },
  "logging": {
    "transports": ["file", "stdout"]
  },
  "process": "systemd",
  "paths": {
    "contentPath": "/var/lib/ghost/content"
  },
  "caching": {
    "adapter": "redis",
    "redis": {
      "host": "172.17.0.14",
      "port": 6379,
      "password": "",
      "db": 0
    }
  }
}

Replace 172.17.0.14 with your Redis IP. Save with Ctrl+X, Y, Enter.

Nano editor showing Ghost config.production.json with Redis configuration

Step 4: Set File Permissions

chown 1000:1000 /mnt/user/appdata/ghost/config.production.json
chmod 644 /mnt/user/appdata/ghost/config.production.json

Verify permissions:

ls -lh /mnt/user/appdata/ghost/config.production.json

Should show -rw-r--r-- 1 1000 1000.

Step 5: Mount Config in Ghost Container

In Unraid Docker interface:

  1. Click Ghost container icon → Edit
  2. Click Add another Path, Port, Variable, Label or DevicePath
  3. Configure:
    • Name: Config File
    • Container Path: /var/lib/ghost/config.production.json
    • Host Path: /mnt/user/appdata/ghost/config.production.json
    • Access Mode: Read/Write
  4. Click Apply

Ghost restarts automatically.

Unraid Docker edit interface showing path mapping for config file

You can also specify variable to set the value, but it seem to have no effect for me, only the Config File settings seem to work, perhaps some Unraid issue or something I have that I cannot be bothered to find out now. Test and let me know.

Additional Unraid Config if needed

Step 6: Verify Ghost Started

Check Ghost logs in Unraid Docker tab (click Ghost icon → Logs) or via terminal:

docker logs Ghost --tail 50

Look for no Redis connection errors. Also verify that Ghost reads the config:

docker exec -it Ghost cat /var/lib/ghost/config.production.json

Unraid Docker logs showing Ghost startup without errors

Step 7: Verify Redis Connection

Check Redis has active Ghost connection:

docker exec -it Redis redis-cli CLIENT LIST

You should see Ghost’s IP (typically 172.17.0.10) in connected clients.

Check cached items:

docker exec -it Redis redis-cli DBSIZE

Visit your Ghost site, then run DBSIZE again. The number should increase.

Monitor cache activity:

docker exec -it Redis redis-cli MONITOR

Navigate your Ghost site and watch cache operations. Press Ctrl+C to stop.

Check cache statistics:

docker exec -it Redis redis-cli INFO stats

Look for keyspace_hits and keyspace_misses. More hits than misses indicates effective caching.

Check memory usage:

docker exec -it Redis redis-cli INFO memory | grep used_memory_human

Conclusion

The persistent configuration file ensures your Redis setup survives Ghost container updates, Unraid server restarts, and Docker service maintenance without manual reconfiguration. With database queries reduced by 60-80% and page load times improved by 40-60%, your Ghost installation now delivers faster content to visitors whilst reducing strain on your Unraid array.

You might ask, why Ghost and why am I writing this on my Wordpress blog? I run Ghost self-hosted on my Unraid server as it’s way more easier and lightweight than Wordpress. Ghost doens’t have that many plugins and support like Wordpress, but for a blog, it’s perfect and super fast. Will I be running Ghost for BMO site? If I knew about Ghost back in 2013, then yes… I would’ve setup my site on Ghost, it’s that good and slick. At that time, it was mostly Wordpress, Joomla. Drupal was there but there wasn’t enough documentations to setup it that easily.

Also, why Redis if it’s for few users only? Meh!, I just wanted to try it. Nothing serious but it was fun to try.

That’s it, Enjoy!


文章来源: https://www.blackmoreops.com/setup-redis-cache-on-ghost-unraid-complete-guide/
如有侵权请联系:admin#unsafe.sh