YunoHost-Apps / gotosocial_ynh

GoToSocial package for YunoHost: an ActivityPub social network server, written in Golang.
https://gotosocial.org
Other
10 stars 5 forks source link

Asking help for NGINX 404 rule #97

Closed xmgz closed 10 months ago

xmgz commented 1 year ago

related to https://github.com/YunoHost-Apps/gotosocial_ynh/issues/86 , I'm not askin for help on #86

I would like to set a default image to load in old posts (that actually nobody would never be interested in, but that's not an issue :smile: ) that are not correctly linked so any possible user would get an image that says that the image is lost, so not their/my fault (shit happens! :smile_cat: ). Eventually I will adventure to delete broken link images from server so I free some space in the server (small VPS)

Back to topic:

So instead a 404 server error for the image, the server would load a default image. Reference: https://www.nginx.com/resources/wiki/start/topics/tutorials/config_pitfalls/#check-if-file-exists

I've tried adding to /etc/nginx/conf.d/gts.domain.tld.d/gotosocial.conf this code

location /fileserver {
  try_files $uri /fileserver/default.jpg;
}

also tried with fileserver, without /

I have upload default.jpg to /home/yunohost.app/gotosocial/ and set ownership to gotosocial:gotosocial (as the other files/folders in that folder)

because I see that image files are server from gts.domain.tld/fileserver , but it does not work. Should I add this rule to gts.domain.tld.conf (main config file) or have I set wrong location in the config?

Any hint would be valuable. Where should I set this rule without breaking nginx/gotosocial config? Thank you.