迷ったのでメモ。
Apache (mod_proxy利用) + Mongrel でRailsアプリを設置している場合、Proxy * ディレクティブ内(11行目から16行目)にベーシック認証を記述します。下の場合、Railsアプリをlocalhost:3333で起動していますが、そのサーバがMongrelでもThinでもEbbでもなんでも構いません。とりあえずApacheにアクセスが行くので、ここにベーシック認証の記述を行っています。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | <VirtualHost *:80> ServerName hoge.org ErrorLog logs/hoge-error.log CustomLog logs/hoge-access.log combined DocumentRoot /var/www/rails/hoge/public/ ProxyPass / http://localhost:3333/ ProxyPassReverse / http://localhost:3333/ <Proxy *> AuthName "Access Password" AuthUserFile /var/www/auth/.htpasswd AuthType Basic Require valid-user </Proxy> </VirtualHost> |

