我是红宝石开发的新手。我尝试在 Ubuntu 14.04 上安装 phusion 乘客并将其与 apache 集成。
我完成了此页面的第 2.3 步: https ://www.phusionpassenger.com/documentation/Users%20guide%20Apache.html
但是,当我访问类似 url 时http://192.168.0.105/suburl/home.rb
,浏览器会下载 rb 文件,而不是将其作为网页提供。
我迷失在所有的指示中。谁能建议我接下来应该做什么来让我的 home.rb 简单地运行它 puts "hello world"
?
这是我的 /etc/apache/sites-enabled/000-default
<VirtualHost *:80>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
#ServerName www.example.com
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf
</VirtualHost>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
我看到passenger.load 也在mods-enabled 目录中。
通常,当您的浏览器提供文件供您下载时,这意味着网络服务器不会将文件识别为动态内容。它与 php/python/ruby 相同...
首先保持简单。选择 Apache 或 Nginx 来运行您的乘客模块。
如果您选择 apache,请启用 Ubuntu Universe 存储库,然后运行:
另一方面,如果您选择 nginx,则必须安装具有内置支持的 nginx 版本:
此外,您的项目必须至少有 3 个目录
和 1 个文件:
您需要将 DocumentRoot 设置为“public”,但您的代码开始从 config.ru 加载。因此,这是示例 apache Vhost:
从您链接的文档中查看 4.1。