Multiple HTTP_X_ACCEL_MAPPING in one server block

Viewed 296

As the title says, I need to have two HTTP_X_ACCEL_MAPPING environment variables in a server block in Nginx.

Simply specifying twice the config doesn't work since the second one overwrites the first.

This is what I have (doesn't work):

server {
  listen   80;

  root /var/www/mysite/public;
  server_name www.mysite.com;

  passenger_enabled on;
  rails_env production;
  passenger_env_var HTTP_X_ACCEL_MAPPING /var/www/mysite/myfolder/=/loc/;
  passenger_env_var HTTP_X_ACCEL_MAPPING /var/www/mysite/myotherfolder/=/loc2/;
  passenger_pass_header X-Accel-Redirect;

  location /loc {
    root /var/www/mysite/myfolder;
    internal;
  }

  location /loc2 {
    root /var/www/mysite/myfolder;
    internal;
  }

}

Everything works fine with just one HTTP_X_ACCEL_MAPPING but I am unable to specify more than one. I've tried specifying the multiple values by separating them with a comma like the following:

passenger_env_var HTTP_X_ACCEL_MAPPING /var/www/mysite/myfolder/=/loc/,/var/www/mysite/myotherfolder/=/loc2/;

but that didn't work. Anyone knows how to do this?

1 Answers
Related