Search code examples
ruby-on-railsapachepassengervirtualhost

Rails App (Redmine) not served via Apache


I have a website, under which I wanted to install 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), but when I try to access it via a browser by typing its address, I get the list of files. How can I make the application accessible? I do have passenger installed. My virtualhost file is as follows:

     1 <VirtualHost *:80>
  2     ServerName mywebsite.foobar.com
  3     ServerAlias www.mywebsite.foobar.com
  4     ServerAdmin [email protected]
  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>

Also my https virtualhost looks like this:

      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 [email protected]
 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: The website itself is served as a virtualhost, so redmine would be a directory under virtual host.


Solution

  • Ok. So I found my solution on passenger documentation: I basically had to change the options. The related options look like:

     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>