I recently deployed Ghost CMS on a DigitalOcean Droplet, and while it’s running fine, I want to optimize its performance for better speed and efficiency. I came across some optimizations related to caching and database tuning, where they discussed various ways to improve web application performance. However, I’m looking for more insights specific to Ghost CMS.
Some specific areas I’m looking for advice on:
Has anyone implemented these optimizations on their Ghost setup? Would love to hear your recommendations!
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Hey! 👋
I could suggest a few things here when optimizing Ghost CMS on a DigitalOcean Droplet!
If you haven’t started yet, I would recommend the 1-Click Ghost Droplet from the Marketplace that already comes with some optimizations out of the box:
To scale up, I would recommend using a managed MySQL cluster which already comes with performance configurations out of the box:
https://www.digitalocean.com/products/managed-databases-mysql
Besides that I would recommend a few more things:
Speaking of Redis, you can also use it for session storage to reduce the load on the database itself. DigitalOcean also offers a managed Redis solution so this is something that you might want to consider as well:
https://www.digitalocean.com/products/managed-databases-redis
On the Droplet size itself:
- Bobby
Heya,
Here are some other types of optimizations you can try.
Caching is crucial for improving the speed and reducing the load on your server.
Since Ghost runs on Node.js, NGINX can act as a reverse proxy to handle caching efficiently.
proxy_cache_path /var/cache/nginx levels=1:2 keys_zone=ghost_cache:10m max_size=1g inactive=60m use_temp_path=off;
server {
location / {
proxy_cache ghost_cache;
proxy_cache_valid 200 60m;
proxy_cache_use_stale error timeout updating;
proxy_pass http://localhost:2368;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
proxy_http_version 1.1;
proxy_set_header Connection "";
}
}
sudo apt update && sudo apt install redis-server
Configure Ghost to use Redis (config.production.json
):
{
"caching": {
"enabled": true,
"type": "redis",
"host": "127.0.0.1",
"port": 6379
}
}
Restart Ghost.
If your audience is global, Cloudflare provides: ✅ Edge caching (static HTML, images, CSS, JS) ✅ DDoS protection ✅ Automatic image optimization To configure:
/
but exclude /ghost/*
(admin panel).Ghost supports MySQL and SQLite, and both need tuning for performance.
[mysqld]
query_cache_size = 64M
query_cache_type = 1
Don’t forget to Restart MySQL.
Optimize Indexing
sudo mysqlcheck -o ghost_production -u root -p
Enable InnoDB Buffer Pool Tuning:
innodb_buffer_pool_size = 512M
innodb_buffer_pool_instances = 2
Ghost supports CDN for images via config.production.json
.
config.production.json
:{
"storage": {
"active": "ghost-storage-cloudinary",
"ghost-storage-cloudinary": {
"useDatedFolder": false,
"secure": true
}
}
}
Install Cloudinary storage adapter
npm install ghost-storage-cloudinary
Restart Ghost.
You can also try adding Brotli Compression in NGINX.
sudo apt install brotli
Then add:
server {
location / {
brotli on;
brotli_types text/html text/css application/javascript;
}
}
Enable Lazy Loading for images:
<img src="image.jpg" loading="lazy">
Heya, @f60f754977ec49e1b2cad3cf42286e
Ghost has internal caching that can be optimized. You can modify Ghost’s internal caching by editing config.production.json
:
"caching": {
"enabled": true,
"type": "memory",
"max": 500
}
Regards
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.