Post date: 2014/08/17 14:04:25
http://guides.rubyonrails.org/v4.0.6/configuring.htmlによれば、
config.action_controller.relative_url_root can be used to tell Rails that you are deploying to a subdirectory. The default is ENV['RAILS_RELATIVE_URL_ROOT'].
とかいろいろ調べてやったが、結局 rails4.0 + hobo2.1ではsubdirectoryは成功せず。
redmineではうまくいく。しかし、redmine 2.5は、rails3.2ベース。redmineのconfigurationの変更は一切不要だった。rails4の問題かも知れないが、rails4.1ベースはredmine 3でまだリリースされてない。
relative URL rootのためのapache2のconfファイルの例:
<VirtualHost *:80>
ServerName alb-server
DocumentRoot /var/www
<Directory /var/www>
Allow from all
Options -MultiViews
</Directory>
Alias /alb2 /home/anagix/work/alb2/public
<Location /alb2>
PassengerBaseURI /alb2
PassengerAppRoot /home/anagix/work/alb2
</Location>
<Directory /home/anagix/work/alb2/public>
PassengerRuby /opt/rubies/2.0.0-p481/bin/ruby
Options FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
Options -MultiViews
</Directory>
Alias /redmine /home/anagix/work/redmine/public
<Location /redmine>
PassengerBaseURI /redmine
PassengerAppRoot /home/anagix/work/redmine
</Location>
<Directory /home/anagix/work/redmine/public>
PassengerRuby /opt/rubies/2.0.0-p481/bin/ruby
Options FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
Options -MultiViews
</Directory>
### ScriptAlias /cgi-bin/ /var/www/cgi-bin/
### <Directory "/var/www/cgi-bin">
### AllowOverride None
### Options ExecCGI -MultiViews +SymLinksIfOwnerMatch
### Order allow,deny
### Allow from all
###
### </Directory>
###
### ProxyPass /alb2/ ! # THIS IS necessary
### ProxyPass /assets/ !
### ProxyPass /alb_docs/ !
### ProxyPass /cgi-bin/ !
### ProxyPass /myGyazo/ !
### ProxyPass /hello.php/ !
###
### ProxyPass / balancer://mycluster/
### ProxyPassReverse / balancer://mycluster/
### <Proxy balancer://mycluster/>
### BalancerMember http://127.0.0.1:3000 loadfactor=20
### # BalancerMember http://127.0.0.1:3001 loadfactor=20
### Order deny,allow
### allow from all
### </proxy>
###
LogLevel info
ErrorLog /var/log/alb2-error.log
CustomLog /var/log/alb2-access.log combined
</VirtualHost>