【问题标题】:apache + passenger just listing files in public dirapache + 乘客只是在公共目录中列出文件
【发布时间】:2014-11-01 15:45:21
【问题描述】:
<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 等)

【问题讨论】:

    标签: ruby-on-rails apache centos passenger


    【解决方案1】:

    试试这个

    <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>
    

    【讨论】:

    • 感谢您的回复,但很遗憾这并没有起到任何作用。
    • 为什么要使用符号链接?
    • 这就是我们公司的设置方式。
    猜你喜欢
    • 2017-01-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-12-03
    相关资源
    最近更新 更多