スクリーンショット-2015-07-04-21.17

apache2.4でハマったこと

apacheを2.4にしたら動かなくなった。

いつも使っているディレクティブはこんな感じ

NameVirtualHost *:80
<VirtualHost *:80>
 DocumentRoot "/home/newuser"
 ServerName xxxxx.jp
 <Directory "/home/newuser">
 Options FollowSymLinks
 AllowOverride All
 allow from all
 Options -Indexes
 AddHandler cgi-script htaccess
 </Directory>
</VirtualHost>

すると

スクリーンショット-2015-07-04-21.17

 

見事にこんな感じ。

 

エラーログを見てみると、なんかずらずらとエラーが出てた。

その中で気になったエラー。

[authz_core:error] [pid 30160] [client 自分のIPアドレス:65015] AH01630: client denied by server configuration: ディレクトリパス

 

うーん、 サーバ設定によりクライアントが拒否されてる?

allow from all が有効になってないっぽい。

 

 

どうやら 2.4からディレクティブの書式も一部変更になっているようで

Order allow,deny
Allow from all

Require all granted

となったようだ。

なんと迷惑な話だ。

というか古い書式なのに、apachectl configtest してもなんも警告でないのおかしいだろ!

 

ちなみに、おなじみのこれ

NameVirtualHost *:80

も不要になったそうです。

 

まとめ

<VirtualHost *:80>
 DocumentRoot "/home/newuser"
 ServerName xxxxx.jp
 <Directory "/home/newuser">
 Options FollowSymLinks
 AllowOverride All
 Require all granted
 Options -Indexes
 AddHandler cgi-script htaccess
 </Directory>
</VirtualHost>

 

 

 

コメントを残す

メールアドレスが公開されることはありません。 * が付いている欄は必須項目です

次のHTML タグと属性が使えます: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">