Backup restored and images are broken

AI-generated summary

Backup restored and images are broken

The user theRAGEhero restored a backup of their Discourse forum after a VPS format, but images are no longer displaying. They had previously fixed a mixed content warning by removing and re-uploading images before enabling HTTPS.

Their current configuration uses Nginx as a reverse proxy with certbot, and they have provided their nginx.conf file.

pfaffman suggested following the official Discourse installation guide, and theRAGEhero confirmed they used the official installation method, skipping the discourse-setup step due to having a working app.yml file from a previous installation.

pfaffman recommended enabling the force https site setting, which theRAGEhero tried, but it caused them to lose HTTP access.

Benjamin_D asked if the backup might be missing the uploads, but theRAGEhero confirmed that the images are present in the backup.

Hi all,
I’m pretty new to Discourse but I’m already in love with this awesome platform.

I installed the docker version on a VPS and everything was working fine with Nginx as a reverse proxy with certbot.

I had to format the VPS, now with the same configuration, I cannot see the images anymore. I have read that is a common problem but I can’t figure out how to fix it.

https://forumstatale.it/t/vignette-e-meme-storici/22

In the previous installation, I had a warning concerning mixed content between https and https but I fixed it simply removing the images that I’ve uploaded before activating the https.

I could do the same right now since the forum is new, but I’d like to know what I’m doing wrong in case I have to format it again.

nginx.conf (only the part related to Discourse and the three top settings.


     proxy_set_header X-Forwarded-Proto https;
     client_max_body_size 500M;
     proxy_set_header X-Real-IP         $remote_addr; # pass on real client's IP

server { # forumstatale.it
    server_name  forumstatale.it;
    access_log   logs/forum_statale_it.log  main;

    # pass requests for dynamic content to rails/turbogears/zope, et al
    location / {
      proxy_pass      http://app;
    }

    listen 443 ssl; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/forumstatale.it/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/forumstatale.it/privkey.pem; # managed by Certbot
    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot

}
    server {
    if ($host = forumstatale.it) {
        return 301 https://$host$request_uri;
    } # managed by Certbot


    listen       80;
    server_name  forumstatale.it;
    return 404; # managed by Certbot


}

Thank you in advance.

Did you follow the Discourse official Standard Installation or something else?

I have used the official one (discourse/docs/INSTALL-cloud.md at main · discourse/discourse · GitHub). The only thing that I have skipped is the ./discourse-setup since I already had my app.yml file that was working perfectly in the previous installation. So I used ./launcher rebuild app.

thank you

You might try turning on the force https site setting.

Hi Alessandro,
Could you have restored a backup that didn’t include the uploads ? (I only ask because i did once :roll_eyes:)
You might try to upload a new file, or verify that the one of your post /var/discourse/shared/standalone/uploads/default/original/1X/895d0d7c67affaa2caff31c74bd3ef6efbf307e9.jpeg exists ?

It works but then I lose the https. (I removed it from Discourse)

I checked in the backup and there are the images I’ve uploaded.