/images/ folder returns 404 in sub-folder install


#1

Hi,

I’m new to Discourse.

I did a docker install on a clean Ubuntu 16.04.
Modified my containers/app.yml to add
DISCOURSE_RELATIVE_URL_ROOT: /forum

and

run:
  - exec: echo "Beginning of custom commands"
  - exec:
      cd: $home
      cmd:
        - mkdir -p public/forum
        - cd public/forum && ln -s ../uploads && ln -s ../backups
  - replace:
     global: true
     filename: /etc/nginx/conf.d/discourse.conf
     from: proxy_pass http://discourse;
     to: |
        rewrite ^/(.*)$ /forum/$1 break;
        proxy_pass http://discourse;
  - replace:
     filename: /etc/nginx/conf.d/discourse.conf
     from: etag off;
     to: |
        etag off;
        location /forum {
           rewrite ^/forum/?(.*)$ /$1;
        }
  ## If you want to set the 'From' email address for your first registration, uncomment and change:
  ## After getting the first signup email, re-comment the line. It only needs to run once.
  #- exec: rails r "SiteSetting.notification_email='info@unconfigured.discourse.org'"
  - exec: echo "End of custom commands"

And then rebuilt it using ./launcher rebuild app
Some of the images still return a 404 after that.
Example.
https://example.com/images/emoji/twitter/wrench.png?v=5
https://example.com/images/emoji/twitter/hatching_chick.png?v=5

I’m using Nginx as a reverse proxy to serve locations starting with /forum
But since Discourse itself is linking to /images/... instead of /forum/images/... I’m a bit lost.

Can someone please help?


(Neil Lalonde) #2

You’ll need to remap existing links. There are instructions at the end of this post about remapping:


#3

Thanks for the reply Neil,

I had already done all of the above. I’m still facing the issue with /images/emoji/*. everything else works wonderfully.


#4

Actually wait, I just checked it again to give you an example but the issue has magically sorted itself out :sweat_smile: