Rails 应用程序 (Redmine) 不是通过 Apache 提供的

Rails App (Redmine) not served via Apache

我有一个网站,我想在该网站下安装 redmine(rails application) so that I could access redmine as a subdirectory (http://mywebsite.foobar.com/redmine). I have installed redmine, and I can access it locally (lynx http://localhost:3000),但是当我尝试通过输入地址通过浏览器访问它时,我得到了文件列表。如何使应用程序可访问?我确实安装了乘客。我的虚拟主机文件如下:

     1 <VirtualHost *:80>
  2     ServerName mywebsite.foobar.com
  3     ServerAlias www.mywebsite.foobar.com
  4     ServerAdmin admin@foobar.com
  5     Redirect permanent / https://mywebsite.foobar.com/
  6 
  7     DocumentRoot /path/to/www/
  8     ReadmeName README.html
  9     IndexOptions SuppressHTMLPreamble
 10 
 11         <Directory "/path/to/www">
 12             Options Indexes FollowSymLinks
 13             Order allow,deny
 14             Allow from all
 15 →           Require all granted
 16             IndexIgnore ..
 17             IndexIgnore README.html
 18         </Directory>
 19 
 20         RailsEnv production
 21 → →     RewriteEngine on
 22 → → →   Alias /redmine /path/to/www/redmine/public/
 23 → → →   <Directory "/path/to/www/redmine/public/">
 24 → → → →    Order allow,deny
 25 → → → →    allow from all
 26 → →        Options +Indexes +FollowSymLinks -MultiViews +ExecCGI
 27 → →        Require all granted
 28 → → →   </Directory>
 29 
 30 
 31 
 32         Include aliases.conf
 33         Include /etc/apache2/foobar/security.conf
 34 </VirtualHost>

我的 https 虚拟主机也是这样的:

      1 <VirtualHost *:443>
  2     SSLEngine On
  3     SSLCertificateFile /etc/apache2/ssl/foobar.crt
  4     SSLCertificateKeyFile /etc/apache2/ssl/foobar.key
  5     SSLCertificateChainFile /etc/apache2/ssl/gd_bundle.crt  
  6 
  7     ServerName mywebsite.foobar.com
  8     ServerAlias www.mywebsite.foobar.com
  9     ServerAdmin admin@foobar.com
 10     UseCanonicalName Off
 11 
 12     DocumentRoot /path/to/www/
 13     RailsEnv Production
 14     RewriteEngine on
 15     
 16     <Directory "/path/to/www/">
 17          Require all granted
 18     </Directory>
 19 
 20  
 21     Alias /redmine /path/to/www/redmine/public
 22     
 23     <Location /redmine>
 24           PassengerBaseURI /redmine
 25           PassengerAppRoot /path/to/www/redmine/public/
 26     </Location>
 27     
 28     <Directory "/path/to/www/redmine/public">
 29           Order allow,deny
 30           allow from all
 31           Options +Indexes +FollowSymLinks -MultiViews +ExecCGI
 32           Require all granted
 33     </Directory>
 34 
 35     Include /etc/apache2/foobar/security.conf
 36          
 37     
 38 </VirtualHost>

P.S:网站本身就是一个虚拟主机,所以redmine是虚拟主机下的一个目录。

好的。所以我在 passenger documentation 上找到了我的解决方案:我基本上必须更改选项。相关选项如下所示:

 39     Alias /redmine /path/to/www/redmine/public/
 40     <Location /redmine>
 41             PassengerBaseURI /redmine
 42             PassengerAppRoot /path/to/www/redmine
 43     </Location> 
 44     <Directory /path/to/www/redmine/public>
 45             Allow from all
 46             Options +Indexes +FollowSymLinks -MultiViews +ExecCGI
 47             Require all granted
 48     </Directory>