3

サーバー上にあるRailsアプリを表示するようにapacheをどのように設定しますか?Railsアプリはローカルホストで完全に機能しますが、外部サイトにアクセスすると、インデックス情報が表示されます

このような

Name    Last modified   Size    Description
[TXT]   404.html    21-May-2012 21:38   728      
[TXT]   422.html    21-May-2012 21:38   711      
[TXT]   500.html    21-May-2012 21:38   643      
[IMG]   favicon.ico 21-May-2012 21:38   0    
[TXT]   robots.txt  21-May-2012 21:38   204      

これは私の仮想ホスト情報です

<VirtualHost *:80>
      ServerAdmin example@example.com
      ServerName server.example.com
      # ServerAlias
      DocumentRoot /var/www/sample_app/current/public
      ErrorLog /var/www/sample_app/error.log

          RailsEnv production
        <Directory "/var/www/sample_app/current/public">
          Options Indexes FollowSymLinks MultiViews
          Order allow,deny
          Allow from all
        </Directory>
</VirtualHost>
4

1 に答える 1

7

それはそうではないかもしれませんが、乗客のドキュメントが推奨するものは次のとおりです。

<VirtualHost *:80>
    ServerName www.mycook.com
    DocumentRoot /webapps/mycook/public
    <Directory /webapps/mycook/public>
        Allow from all
        Options -MultiViews
    </Directory>
</VirtualHost>

MultiViewsはPassengerと互換性がないことが明確に述べられています。

だからあなたは試すことができます:

  • インデックスオプションの削除
  • -MultiViews代わりに指定するMultiViews

正直なところ、問題の原因となったのはこのオプションかもしれないと思ったので、インデックスを本番アプリに追加してみましたが、何も変更されませんでした。 「それはあなたの側で物事を修正するかもしれないということです。

更新別の答え から、あなたが試すことができるのはPassengerResolveSymlinksInDocumentRootオプションを追加することです:

<VirtualHost *:80>
    ServerName www.mycook.com
    DocumentRoot /webapps/mycook/public
    <Directory /webapps/mycook/public>
        Allow from all
        Options -MultiViews
        PassengerResolveSymlinksInDocumentRoot on
    </Directory>
</VirtualHost>
于 2012-05-21T23:23:34.203 に答える