blog.sowatchasayin

Rails etc.

Showing posts with label Passenger. Show all posts
Showing posts with label Passenger. Show all posts

rails + passengerでbasic認証

こんな感じでを追加してあげればOK。
LocationディレクティブはDirectoryディレクティブとは違ってウェブ空間に対する設定を行うので、/adminとか相対URLで指定できると。


<VirtualHost *:80>
ServerAdmin webmaster@localhost
ServerName xx.xxx.xxx.xxx
ServerAlias xx.xxx.xxx.xxx
DocumentRoot /var/www/myapp/current/public
<Directory /var/www/myapp/current/public>
Options FollowSymLinks -MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
<Location /admin>
AuthUserFile /home/somebody/.htpasswd
AuthGroupFile /dev/null
AuthName "Please enter your ID and password"
AuthType Basic
require valid-user
</Location>
</VirtualHost>


.htpasswdの場所はホームディレクトリ以外がいいような…。

こちらを参考にしました!
Slicehost Forum - Passenger and htaccess, multiple login prompts

乗組員。

Debian Lenny + Rails2.3.3 + Passenger2.2.4で、デプロイしたっす。
「とりあえずやってよう」と思いやってみたら、特に何の問題もなく、あっという間に配備できました。
インストール後、
# passenger-install-apache2-module
で対話的に進みます。

参考:
Apache上でRuby on Railsアプリケーションを動かす/Passenger(mod_rails for Apache)の利用

Author

Fujimura Daisuke
http://fujimuradaisuke.com

Labels