AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / server / 问题 / 637508
Accepted
John
John
Asked: 2014-10-17 05:11:56 +0800 CST2014-10-17 05:11:56 +0800 CST 2014-10-17 05:11:56 +0800 CST

网站一直要求下载 ruby​​ 文件?

  • 772

我是红宝石开发的新手。我尝试在 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 目录中。

apache-2.2
  • 1 1 个回答
  • 66 Views

1 个回答

  • Voted
  1. Best Answer
    Jakov Sosic
    2014-10-17T06:02:48+08:002014-10-17T06:02:48+08:00

    通常,当您的浏览器提供文件供您下载时,这意味着网络服务器不会将文件识别为动态内容。它与 php/python/ruby 相同...

    首先保持简单。选择 Apache 或 Nginx 来运行您的乘客模块。

    如果您选择 apache,请启用 Ubuntu Universe 存储库,然后运行:

    apt-get install libapache2-mod-passenger
    

    另一方面,如果您选择 nginx,则必须安装具有内置支持的 nginx 版本:

    apt-get install ruby-passenger
    

    此外,您的项目必须至少有 3 个目录

    /var/www/myproject
    /var/www/myproject/public
    /var/www/myproject/tmp
    

    和 1 个文件:

    /var/www/myproject/config.ru
    

    您需要将 DocumentRoot 设置为“public”,但您的代码开始从 config.ru 加载。因此,这是示例 apache Vhost:

    <VirtualHost *:80>
        ServerAdmin webmaster@localhost
        DocumentRoot /var/www/myproject/public
    
        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined
    </VirtualHost>
    

    从您链接的文档中查看 4.1。

    • 1

相关问题

  • Apache Django Mod_Wsgi - 自动重新加载应用程序

  • Apache:对多个虚拟主机使用相同的目录指令

  • Apache 上的子域不工作 - 找不到服务器

  • PHP 作为 CGI 还是 Apache 模块?

  • 避免将某些丢失的文件记录到 Apache2 错误日志中

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve