使用 Nginx/Passenger 部署 Grape API

Deploy Grape API with Nginx/Passenger

我的服务器上安装了 Nginx 和 Passenger。尝试 运行 葡萄(架子) API 关闭它。

当我部署 Rails 个应用程序时,我在 Nginx conf 中有这个服务器块;

server {
    listen 80;
    server_name yourserver.com;

    # Tell Nginx and Passenger where your app's 'public' directory is
    root /path-to-app/public;

    # Turn on Passenger
    passenger_enabled on;
    passenger_ruby /path-to-ruby;
}

Passenger tutorial 上的说明是;

The server block's root must point to your application's public subdirectory.

如果是我的葡萄 API,这个根会是什么?

如果是 grape,您需要创建一个空的 public 文件夹并在服务器块中指向该文件夹。