blog.sowatchasayin

Rails etc.

Showing posts with label apache. Show all posts
Showing posts with label apache. 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

名刺

Railsアプリを配備する目的で借りたVPS。
ドメインもとったし、せっかくなので名刺的なページを作りました。

http://so-wat-cha-say.in/

Debian + Apacheです。別にPassengerを使ってRailsアプリを動かしているので、「名前ベースのバーチャルホスト」でリクエストの振り分けをしました。「名前ベースのバーチャルホスト」…なんとも中途半端な翻訳です。

このあたりを参考にしました。
Hosting multiple websites with Apache2
名前ベースのバーチャルホスト

背景の写真はランダムに表示されるようにしました。リロードしてみてください。
東京で撮ったものと、ドイツに旅行に行った時に撮ったものです。
Ricoh R10で撮りました。ついでに一枚。北の丸公園です。


Author

Fujimura Daisuke
http://fujimuradaisuke.com

Labels