apache httpd 2.4 で嵌まる

DP1M0712 🏛️

apahce httpd 2.2.(wheezy)から2.4.(jessie)への移行で適当なサーバをえいやで上げて動かなくなったのを復旧したメモ.

virtual host が有効にならない

/etc/apache2/sites-enabled/ 以下には設定ファイルがあるのに読み込まれず default しか表示されない.

sites-available からリンクを貼り直そうとするとエラーとなる

$ sudo a2dissite example.com
ERROR: Site example.com does not exist!
$ sudo rm /etc/apache2/sites-enabled/example.com
$ sudo a2ensite example.com
ERROR: Site example.com does not exist!

エラーメッセージで検索するとファイル名を *.conf にすれば良いよう.

この部分の該当場所は /etc/apache2/apache2.conf のここ

IncludeOptional sites-enabled/*.conf

2.2からの変更を確認するとこのように変わっていた.

 # Include the virtual host configurations:
-Include sites-enabled/
+IncludeOptional sites-enabled/*.conf

ということでこんな感じで

$ sudo rm /etc/apache2/sites-enabled/example.com
$ sudo mv /etc/apache2/sites-available/example.com /etc/apache2/sites-available/example.com.conf
$ sudo  a2ensite example.com.conf

設定ファイルの数が多かったら /etc/apache2/apache2.conf の設定を * にしても良いかも(未検証)

-IncludeOptional sites-enabled/*.conf
+IncludeOptional sites-enabled/*

403 が出る

エラーログは以下のような感じ.見慣れないエラー.

[authz_core:error] [pid 20566] [client nnn.nnn.nnn.nnn:49821] AH01630: client denied by server configuration: /var/www

以下のガイドを見るとどうもacl 周りのコマンド変更のようで

Order deny,allow
Deny from all

の代わりに

Require all granted

で動くようになった.


コメントを残す

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

To respond on your own website, enter the URL of your response which should contain a link to this post's permalink URL. Your response will then appear (possibly after moderation) on this page. Want to update or remove your response? Update or delete your post and re-enter your post's URL again. (Find out more about Webmentions.)