OXY NOTES

XAMPPのApacheでエラーが出た際の対処法

新しくXAMPPの1.8.2をインストール後、エラーが出たので修正。

修正時のただのメモです。

エラーログはこちら「C:\xampp\apache\logs\error.log」。


エラー1

[Sun Oct 12 12:00:00.870600 2014] [core:alert] [pid 7168:tid 1844] [client ::1:64386] C:/xampp/htdocs/xampp/example/.htaccess: order not allowed here, referer: http://localhost/example/example.php

原因

AllowOverrideの設定で.htaccessが無効になっている。
xamppの場合は「C:\xampp\apache\conf\httpd.conf」だけでなく、「C:\xampp\apache\conf\extra\httpd-xampp.conf」も読み込んでいるので注意。

対処

http-xampp.confの以下の部分を修正(http.confでは無いので注意)

<Directory "C:/xampp/htdocs/xampp">
    <IfModule php5_module>
    	<Files "status.php">
    		php_admin_flag safe_mode off
    	</Files>
    </IfModule>
    AllowOverride AuthConfig
</Directory>

↓下のように修正

<Directory "C:/xampp/htdocs/xampp">
    <IfModule php5_module>
    	<Files "status.php">
    		php_admin_flag safe_mode off
    	</Files>
    </IfModule>
    #AllowOverride AuthConfig
    AllowOverride All
</Directory>

Apache再起動。


エラー2

[Thu Oct 16 12:00:00.918913 2014] [ssl:warn] [pid 3040:tid 444] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name

原因

バーチャルホストのSSLのServerNameの設定ができていない。
設定ファイルは上と同じようにextraディレクトリに「httpd-ssl.conf」という名前で保存されている。

対処

本来であればServerNameをバーチャルホスト名にしたいが、デフォルトで用意されているSSL用の証明書「conf/ssl.crt/server.crt」がlocalhost用に発行されているため、「server certificate does NOT include an ID which matches the server name」がでる。
そもそもローカルでのSSLは動作テスト用だと思うので「localhost:443」とする。

<VirtualHost _default_:443>

#   General setup for the virtual host
DocumentRoot "C:/xampp/htdocs"
ServerName www.example.com:443
ServerAdmin admin@example.com
ErrorLog "C:/xampp/apache/logs/error.log"
TransferLog "C:/xampp/apache/logs/access.log"

↓下のように修正

<VirtualHost _default_:443>

#   General setup for the virtual host
DocumentRoot "C:/xampp/htdocs"
#ServerName www.example.com:443
ServerName localhost:443
ServerAdmin admin@example.com
ErrorLog "C:/xampp/apache/logs/error.log"
TransferLog "C:/xampp/apache/logs/access.log"

Apache再起動。