Thanks a lot for the feedback Hannah!
Huh, that explains things; I would have expected that changing the ghost url would also have modified the old image paths to the new path.
So, following your advice I added a new location to my NGINX config:
location /content/images/ {
return 301 /blog/content/images/;
}
That improves things somewhat. Images in the body of the posts are now being found. Hurray!
But, for some reason Ghost is still not serving the featured image. (I’m not sure if this is the correct way to refer to this, it’s not an in-post image, rather it’s the main “header” image of a post. E.g. what this post is referring to.)
Possibly related, but when I try to add/modify the publication logo, or post’s header image, favicon etc from the Ghost admin page then I am still getting access errors like so:
2019/09/12 10:12:52 [error] 7561#7561: *155 upstream prematurely closed connection while reading response header from upstream, client: 131.111.5.150, server: example.com, request: "POST /blog/ghost/api/canary/admin/images/upload/ HTTP/2.0", upstream: "http ://127.0.0.1:2369/blog/ghost/api/canary/admin/images/upload/", host: "example .com", referrer: "https ://example .com/blog/ghost/"
It would seem that some part of Ghost is still trying to access the old location?
If it helps here is the output of ghost log showing an error:
+ sudo systemctl is-active ghost_example-com
[2019-09-12 10:12:57] WARN Can't connect to the bootstrap socket (localhost 8000) ECONNREFUSED
[2019-09-12 10:12:57] WARN Tries: 1
[2019-09-12 10:12:57] WARN Retrying...
[2019-09-12 10:12:57] WARN Can't connect to the bootstrap socket (localhost 8000) ECONNREFUSED
[2019-09-12 10:12:57] WARN Tries: 2
[2019-09-12 10:12:57] WARN Retrying...
[2019-09-12 10:12:58] WARN Can't connect to the bootstrap socket (localhost 8000) ECONNREFUSED
[2019-09-12 10:12:58] INFO Ghost boot 4.249s
[2019-09-12 10:14:18] WARN Cookie ghost-members-ssr not found
[2019-09-12 10:14:18] INFO "GET /blog/awesome_blog_post" 301 17ms
[2019-09-12 10:14:22] WARN Cookie ghost-members-ssr not found
[2019-09-12 10:14:23] ERROR
NAME: InternalServerError
CODE: IMAGE_SIZE_URL
MESSAGE: URL empty or invalid.
level: critical
"/content/images/2019/08/awesome_image.png"
InternalServerError: URL empty or invalid.
at new InternalServerError (/var/www/ghost/versions/2.31.0/node_modules/ghost-ignition/lib/errors/index.js:77:23)
at _imageSizeFromUrl.then.catch (/var/www/ghost/versions/2.31.0/core/server/lib/image/image-size.js:150:31)
at tryCatcher (/var/www/ghost/versions/2.31.0/node_modules/bluebird/js/release/util.js:16:23)
at /var/www/ghost/versions/2.31.0/node_modules/bluebird/js/release/catch_filter.js:34:37
at tryCatcher (/var/www/ghost/versions/2.31.0/node_modules/bluebird/js/release/util.js:16:23)
at Promise._settlePromiseFromHandler (/var/www/ghost/versions/2.31.0/node_modules/bluebird/js/release/promise.js:517:31)
at Promise._settlePromise (/var/www/ghost/versions/2.31.0/node_modules/bluebird/js/release/promise.js:574:18)
at Promise._settlePromise0 (/var/www/ghost/versions/2.31.0/node_modules/bluebird/js/release/promise.js:619:10)
at Promise._settlePromises (/var/www/ghost/versions/2.31.0/node_modules/bluebird/js/release/promise.js:695:18)
at _drainQueueStep (/var/www/ghost/versions/2.31.0/node_modules/bluebird/js/release/async.js:138:12)
at _drainQueue (/var/www/ghost/versions/2.31.0/node_modules/bluebird/js/release/async.js:131:9)
at Async._drainQueues (/var/www/ghost/versions/2.31.0/node_modules/bluebird/js/release/async.js:147:5)
at Immediate.Async.drainQueues (/var/www/ghost/versions/2.31.0/node_modules/bluebird/js/release/async.js:17:14)
at runCallback (timers.js:810:20)
at tryOnImmediate (timers.js:768:5)
at processImmediate [as _immediateCallback] (timers.js:745:5)
[2019-09-12 10:14:23] ERROR
NAME: InternalServerError
CODE: IMAGE_SIZE_URL
MESSAGE: URL empty or invalid.
level: critical
"/content/images/2019/08/awesome_image.png"
InternalServerError: URL empty or invalid.
at new InternalServerError (/var/www/ghost/versions/2.31.0/node_modules/ghost-ignition/lib/errors/index.js:77:23)
at _imageSizeFromUrl.then.catch (/var/www/ghost/versions/2.31.0/core/server/lib/image/image-size.js:150:31)
at tryCatcher (/var/www/ghost/versions/2.31.0/node_modules/bluebird/js/release/util.js:16:23)
at /var/www/ghost/versions/2.31.0/node_modules/bluebird/js/release/catch_filter.js:34:37
at tryCatcher (/var/www/ghost/versions/2.31.0/node_modules/bluebird/js/release/util.js:16:23)
at Promise._settlePromiseFromHandler (/var/www/ghost/versions/2.31.0/node_modules/bluebird/js/release/promise.js:517:31)
at Promise._settlePromise (/var/www/ghost/versions/2.31.0/node_modules/bluebird/js/release/promise.js:574:18)
at Promise._settlePromise0 (/var/www/ghost/versions/2.31.0/node_modules/bluebird/js/release/promise.js:619:10)
at Promise._settlePromises (/var/www/ghost/versions/2.31.0/node_modules/bluebird/js/release/promise.js:695:18)
at _drainQueueStep (/var/www/ghost/versions/2.31.0/node_modules/bluebird/js/release/async.js:138:12)
at _drainQueue (/var/www/ghost/versions/2.31.0/node_modules/bluebird/js/release/async.js:131:9)
at Async._drainQueues (/var/www/ghost/versions/2.31.0/node_modules/bluebird/js/release/async.js:147:5)
at Immediate.Async.drainQueues (/var/www/ghost/versions/2.31.0/node_modules/bluebird/js/release/async.js:17:14)
at runCallback (timers.js:810:20)
at tryOnImmediate (timers.js:768:5)
at processImmediate [as _immediateCallback] (timers.js:745:5)
[2019-09-12 10:14:23] WARN
NAME: HelperWarning
CODE: SLOW_GET_HELPER
MESSAGE: {{#get}} helper took 308ms to complete
level: normal
ERROR DETAILS:
{"api":"v2.postsPublic.browse","apiOptions":{"limit":"3"},"returnedRows":3}
[2019-09-12 10:14:23] WARN
NAME: HelperWarning
CODE: SLOW_GET_HELPER
MESSAGE: {{#get}} helper took 497ms to complete
level: normal
ERROR DETAILS:
{"api":"v2.postsPublic.browse","apiOptions":{"include":"tags","limit":"3","filter":"tags:[awesome-tag]+id:-5c484e80a04c066da0b940ef"},"returnedRows":1}
[2019-09-12 10:14:23] WARN
NAME: HelperWarning
CODE: SLOW_GET_HELPER
MESSAGE: {{#get}} helper took 320ms to complete
level: normal
ERROR DETAILS:
{"api":"v2.tagsPublic.browse","apiOptions":{"order":"count.posts desc","include":"count.posts","limit":"all"},"returnedRows":3}
[2019-09-12 10:14:23] INFO "GET /blog/content/images/" 404 7ms
[2019-09-12 10:14:23] INFO "GET /blog/awesome_blog_post/" 200 920ms
[2019-09-12 10:28:15] INFO "GET /blog/ghost/api/canary/admin/posts/?limit=30&page=1&filter=status%3A%5Bdraft%2Cscheduled%2Cpublished%5D" 200 265ms
[2019-09-12 10:28:19] INFO "GET /blog/ghost/api/canary/admin/settings/?type=blog%2Ctheme%2Cprivate%2Cmembers" 200 51ms