【问题标题】:Can't run ruby on rails project under apache /var/www/无法在 apache /var/www/ 下运行 ruby​​ on rails 项目
【发布时间】:2011-12-11 15:00:51
【问题描述】:

无法在 apache /var/www/ 下运行 ruby​​ on rails 项目

我安装在 debian/ubuntu 上:

ii  libapache2-mod-fastcgi                2.4.7~0910052141-1                         Apache 2 FastCGI module for long-running CGI scripts
ii  libapache2-mod-scgi                   1.13-1build1                               Apache module implementing the SCGI protocol
ii  libcgic-dev                           2.05-2                                     C library for developing CGI applications
ii  libcgic2                              2.05-2                                     C library for developing CGI applications
ii  libcupscgi1                           1.4.6-5ubuntu1                             Common UNIX Printing System(tm) - CGI library
ii  libfcgi-ruby1.8                       0.8.8-1                                    FastCGI library for Ruby
ii  libfcgi-ruby1.9.1                     0.8.8-1                                    FastCGI library for Ruby
ii  libfcgi0ldbl                          2.4.0-8ubuntu1                             Shared library of FastCGI
ii  libgcgi0                              0.9.5.dfsg-6                               library for CGI programs in C
ii  libapache2-mod-passenger              2.2.11debian-2                             Rails and Rack support for Apache2

将 demo/ 放在 /var/www/ http://localhost/demo => 我在浏览器上找到了文件夹/文件 我还编辑了 apache2.conf:“cat /etc/apache2/sites-available/default”

ServerAdmin webmaster@localhost

DocumentRoot /var/www
<Directory />
    Options FollowSymLinks
    AllowOverride None
</Directory>
<Directory /var/www/>
    Options Indexes FollowSymLinks MultiViews
    #AllowOverride None
    AllowOverride All
    Order allow,deny
    allow from all
</Directory>

ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
    AllowOverride None
    Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
    Order allow,deny
    Allow from all
</Directory>

ErrorLog ${APACHE_LOG_DIR}/error.log

# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn

CustomLog ${APACHE_LOG_DIR}/access.log combined

Alias /doc/ "/usr/share/doc/"
<Directory "/usr/share/doc/">
    Options Indexes MultiViews FollowSymLinks
    AllowOverride None
    Order deny,allow
    Deny from all
    Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>

有人帮忙,

【问题讨论】:

    标签: ruby-on-rails


    【解决方案1】:

    您必须将 DocumentRoot 指向 Rails 应用程序的公共文件夹。在您的情况下,这将是/var/www/demo/publicSee the documentation for more information.

    如果这将是一个生产服务器,请寻求专业人士的帮助。否则,您可能会使您的应用程序(以及您的用户数据)易受攻击。

    【讨论】:

      【解决方案2】:

      除了@Wukerplank...

      从您发布的内容来看,您似乎没有配置 Phusion Passenger(又名 mod_rails)

      这是Passenger configuration 的文档链接。

      【讨论】:

        猜你喜欢
        • 2011-10-01
        • 2021-01-14
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多