Attachments serving locally on the server but not publicly

No did not follow that guide. But when I look at it I can see that only step missed was:

  1. The old domain shows up in allowed iframe list along with the new domain in settings.
  2. remapping domain in posts which I was going to do later anyway including a rebake once this issue is resolved. The post in question was rebaked and does not have the old domain in the URL of the image.

Are these two relevant points?

Even the theme image is giving a 404.

I see the nginx logs are littered with permission denied errors for images.

Plus I see this but unable to fix the permissions. Maybe I messed up some step like ran setup with wrong user.

root@ip-172-26-0-app:/var/www/discourse# ls -ld /shared/uploads/default/optimized/3X
drwx---r-x 18 discourse www-data 4096 Jun 29 17:52 /shared/uploads/default/optimized/3X
root@ip-172-26-0-app:/var/www/discourse# ls -ld /shared/uploads/default/optimized
drwx---r-x 5 discourse www-data 4096 Jun 29 17:52 /shared/uploads/default/optimized

Edit:
Fixed it by changing directory permissions and ownership.