在 UNIX 套接字中运行 Rails Server

tub*_*bbo 5 ruby ruby-on-rails nginx thin

rails server是否可以在 UNIX 套接字中运行?

我问这个是因为rails server它给出了如此漂亮的输出,而且很容易区分 SQL 查询和 HTTP 请求等。但是,我使用的是 Nginx,所以我想使用 UNIX 套接字连接应用程序服务器,但我'我遇到了一些麻烦。

以下命令会导致错误:

bundle exec rails server thin --socket=/var/run/rails_app.sock
Run Code Online (Sandbox Code Playgroud)

它似乎试图解析--socket为 的选项rails server,而不是thin。有没有办法解决这个问题,或者我是否坚持使用thin start并屈服于不太漂亮的日志输出?

the*_*Man 3

尝试使用:

bundle exec rails server thin -- --socket=/var/run/rails_app.sock
Run Code Online (Sandbox Code Playgroud)

--用于标记许多 *nix 应用程序上第一个命令的参数结束。

man sh

   --        A  --  signals the end of options and disables further option processing.  Any arguments after the --
             are treated as filenames and arguments.  An argument of - is equivalent to --.
Run Code Online (Sandbox Code Playgroud)