Project

General

Profile

serving static files redmine

Added by ashraf alzyoud 3 months ago

Disable serving static files from the `/public` folder by default since # Apache or NGINX already handles this.
1. config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?
Specifies the header that your server uses for sending files
2. config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX

I uncomment these two lines because I'm using nginx and I need serve files
But the problem it's give me in error.log

Missing mapping header

In redmine there

1. attachments
2. thumbs
3. favicon

How I can configuration all these without giving error and I'm not see any examples there how nginx serve files

location /attachments {
  root /var/www/redmine;
  internal; #so /download is not visible to the outside world
}

location / {
  proxy_set_header X-Sendfile-Type X-Accel-Redirect;
  proxy_set_header X-Accel-Mapping /var/www/redmine/files/=/attachments/ #maps a real path to the internal location
  ...
}