
最近、サーバーに Capistrano をセットアップしましたが、うまく動作しています。
仮想ホストを変更して、Capistrano によって作成されたシンボリック リンクを指すようにしました。
仮想ホスト ファイル:
<VirtualHost *:80>
DocumentRoot /var/www/html/my_app.com/current
ServerName my_app.com
<Directory />
Options FollowSymLinks
AllowOverride Indexes
</Directory>
</VirtualHost>
を使用して Apache サーバーを再起動するとsudo service httpd restart
、次のエラーが発生します。
Warning: DocumentRoot [/var/www/html/my_app.com/current] does not exist
ディレクトリcurrent
は確かに存在します。vhost を を指すように設定すると.../my_app.com/
、動作し、デフォルトの Apache ページが表示されますが、問題は へのこのシンボリック リンクですcurrent
(これは、capistrano を使用してアプリケーションをデプロイすると更新されます)。
Amazon ec2 インスタンス、apache 2.2 (LAMP) を使用しています。
つまり、基本的には、仮想ホストをシンボリック リンクにポイントするにはどうすればいいのでしょうか?
アップデート 出力
ls-l
:
lrwxrwxrwx 1 ec2-user ec2-user 57 Aug 28 22:40 current -> /var/www/html/my_app.com/releases/20120828223437
drwxrwxr-x 3 ec2-user ec2-user 4096 Aug 28 22:40 releases
drwxrwxr-x 6 ec2-user ec2-user 4096 Aug 28 16:01 shared
httpd.conf
私の(コメントは削除)では:
<Directory "/var/www/html">
Options Indexes FollowSymLinks
AllowOverride all
Order allow,deny
Allow from all
</Directory>
エラーログ:
[Wed Aug 29 00:04:39 2012] [error] [client 87.194.51.136] Symbolic link not allowed or link target not accessible: /var/www/html/my_app.com/current
[Wed Aug 29 00:04:40 2012] [error] [client 128.30.52.73] Symbolic link not allowed or link target not accessible: /var/www/html/my_app.com/current
[Wed Aug 29 00:04:40 2012] [error] [client 87.194.51.136] Symbolic link not allowed or link target not accessible: /var/www/html/my_app.com/current, referer: http://mydomain.com/
ls -l
の出力/var/www/html/my_app.com/releases/20120828223949
。
drwxrwxr-x 6 ec2-user ec2-user 4096 Aug 28 22:39 20120828223949
コマンドを実行するとls -l /var/www/html/my_app.com/current/
ls: cannot access /var/www/html/my_app.com/current/: No such file or directory
無効なシンボリックリンクのようです... これを修正するにはどうすればいいですか?
答え1
私のコメントとあなたのフォローアップによると、current
シンボリック リンクが有効なターゲットを指していないようです。シンボリック リンクを削除して再度追加してください。
$ rm -f /var/www/html/my_app.com/current
$ ln -s /var/www/html/my_app.com/{releases/20120828223949,current}