Question

If it were php, it'd be something along the lines:

server {
    server_name   ...;
    root   /path/to/root/1;
    location / {
        try_files   $uri   @root2;
    }
    location @root2 {
        root   /path/to/root/1;
        try_files   $uri   /index.php?$args;
    }
    location = /index.php {
        include   fastcgi_params;
        fastcgi_pass   php;
    }
}

In other words, the point is to separate public files into several directories. Is there a way to do this with passenger + nginx + sinatra (to be precise)?

UPD Basic nginx/passenger setup:

server {
    server_name example.com;
    root   /home/yuri/example.com/public;
    passenger_enabled   on;
}

For more information see documentation.

Was it helpful?

Solution

You could try something like this :

server {

  [...]

  root /path/to/public/folder;

  [...]

  location / {
    # Serve static files or forward to passenger
    try_files $uri $uri.html @passenger
  }

  location @passenger {
    passenger_enabled on;
    ...
  }
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top