1

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.

4

1 回答 1

1

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;
    ...
  }
}
于 2013-10-24T13:36:10.617 回答