LoginSignup
6
7

More than 5 years have passed since last update.

Passengerでサブディレクトリを切る

Posted at

httpd.confを設定。

httpd.conf
<VirtualHost *:80>
  ServerName rails.local
  DocumentRoot /Users/hoge/Sites/rails
  RailsEnv development
  <Directory /Users/hoge/Sites/rails>
     AllowOverride all
     Options -MultiViews
     Order deny,allow
     Allow from all
  </Directory>
  RailsBaseURI /myapp
</VirtualHost>

シンボリックリンクを設定する。

$ cd /Users/hoge/Sites/rails
# 注: アプリ内のpublicですぞ!
$ ln -s /path/to/rails/public myapp

http://rails.local/myapp でアクセスできるようになる。

PassengerResolveSymlinksInDocumentRootPassengerAppRootを設定する、という記事もあったが、意味なかった。

「config/environment.rb が見つからない」というエラーが出たが、シンボリックリンクの間違い(publicディレクトリじゃなくてRails.rootを指してた)を直したら動いた。

6
7
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6
7