apache + passenger只是在公共目录中列出文件

时间:2014-09-08 12:11:52

标签: ruby-on-rails apache centos passenger

<VirtualHost *:80>
  # ... server name/aliases and such.

  DocumentRoot /var/www/html
  RackEnv staging
  RackBaseURI /extapp/forms

  <Directory /var/www/html/extapp/forms>
    Options -MultiViews 
    PassengerRuby /home/pstn/.rbenv/versions/2.1.2/bin/ruby
  </Directory>

</VirtualHost>

/var/www/html/extapp/forms是链接到rails 4应用程序的public文件夹的符号链接,目录树的所有权限都是正确的(r + w)。

乘客靴,根据日志中的条目:

[ 2014-09-08 14:07:17.5896 21559/7f8d77305720 agents/Watchdog/Main.cpp:728 ]: All Phusion Passenger agents started!

但是,当我访问相应的路径时,我得到的只是public文件夹中存储的文件的目录列表(即robots.txt等人)

1 个答案:

答案 0 :(得分:0)

试试这个

<Directory /var/www/html/extapp/forms>
Options -MultiViews 
PassengerRuby /home/posten/.rbenv/versions/2.1.2/bin/ruby
PassengerResolveSymlinksInDocumentRoot on
</Directory>

然后重启服务器。

我的服务器配置是

<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

    ServerName mysite
    RailsEnv development
    DocumentRoot /var/www/mysite/public
    <Directory /var/www/mysite/public>
            Allow from all
            Options -MultiViews
            PassengerResolveSymlinksInDocumentRoot on
    </Directory>
    # 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}/ruby-error.log
    CustomLog ${APACHE_LOG_DIR}/ruby-access.log combined

    # For most configuration files from conf-available/, which are

</VirtualHost>