How to run a simple ruby script in any web server (Apache or Mongrel or any thing else)

前端 未结 7 852
半阙折子戏
半阙折子戏 2021-02-05 06:20

It seems very funny to me that when I search something related ruby, all ruby on rails related results popped up. So nobody using raw ruby anymore?

However, I am new to

7条回答
  •  梦毁少年i
    2021-02-05 06:57

    You could configure Apache (for example) to run .rb files as CGI scripts, and then add a shebang line (#!/path/to/your/ruby or maybe #!/usr/bin/env ruby) at the top of the script. It's not optimal, though, as it'd start a new interpreter for each request.

提交回复
热议问题