Problem
I am unable to see uploaded images in my local environment without manually downloading the images and storing them locally. This is inconvenient and slow.
I would like to extend the nginx configuration for the local site to proxy URLs pointing to relative URLs like /content/images/size/w400/2025/02/foo-bar-baz.jpg
so that they instead point to my production URL. This way I can see uploaded images locally but not have to store them locally.
Background
I set up Ghost locally using Ghost-CLI and the ghost install local
command.
I then exported the data JSON from my production site and imported it to my local site.
The site works locally, but all images are missing because they’re pointing to relative URLs for the uploads that don’t exist locally.
Potential Solution
I would like to add a few lines of nginx configuration like this:
location ~ ^/content/images/(.*) {
if (!-e $request_filename) {
rewrite ^/content/images/(.*) https://PROD-URL.com/content/images/$1 redirect;
}
}
But I’m not sure where to do that. Is it possible to make these configuration changes locally?
Configuration details:
- Ghost version: 5.109.2
- Ghost-CLI version: 1.26.1
- Node version: v18.20.5
- OS: macOS Sequoia 15.3
- browser: n/a
- config:
- database client:
sqlite3
- server: port
2368
, host127.0.0.1
- database client: