すべてのディレクトリに対して認証を要求するようにサーバーを設定しました。Apacheのmod_auth_formを使用してインラインログインフォームを生成し、HTTP_REQUESTを保持して、モジュールがログインフォームの表示時に指定したファイル/ディレクトリにユーザーを保持できるようにします。
私の問題はこれです:ドメイン(example.com)に移動すると、ログインフォームが表示されます。良い。間違ったクレデンシャルを使用してログインすると、ログインフォームが再び表示されます。良い。正しいクレデンシャルを入力すると、InternalServer500エラーが発生します。
しかし、私が理解していない奇妙なことは、ディレクトリ(example.com/images/)にアクセスすると、ログインフォームが表示され、ログインすると正しくログインして表示されることです。 /imagesのディレクトリインデックス。これは、任意のサブディレクトリで機能し、http.confで作成したエイリアスのサブディレクトリでも機能します。
それが台無しになるのは、ルート/ドメインレベルだけです。道に迷いました。
http.confの関連情報は次のとおりです。さらに情報が必要な場合はお知らせください。
# Deny access to the entirety of your server's filesystem. You must
# explicitly permit access to web content directories in other
# <Directory> blocks below.
<Directory />
Options FollowSymLinks Indexes
AllowOverride All
Require all granted
</Directory>
--------------------------------------------------------
DocumentRoot "E:/"
# This should be changed to whatever you set DocumentRoot to.
# ======================================================
# !!! DO NOT CHANGE THIS LINE AND THE FOLLOWING ONES !!!
# DocumentRootDirectory
<Directory "E:/">
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
--------------------------------------------------------
<IfModule alias_module>
Alias /images_easyphp "${path}/home/server_images"
<Directory "${path}/home/server_images">
Options Indexes MultiViews
AllowOverride None
Allow from all
Require all granted
</Directory>
<Directory "E:/">
Options FollowSymLinks Indexes
AuthFormProvider file
AuthType form
AuthName "Restricted Access"
Session On
SessionCookieName session path=/
require valid-user
ErrorDocument 401 /WWW/login/index.php
AuthUserFile "c:/server/apache/passwd"
</Directory>
<Directory "E:/WWW/login">
Options FollowSymLinks Indexes
Order allow,deny
Allow from all
Require all granted
</Directory>
<Location /logout>
SetHandler form-logout-handler
AuthFormLogoutLocation http://domain.com
Session On
SessionMaxAge 1
SessionCookieName session path=/
</Location>
ScriptAlias /cgi-bin/ "${path}/apache/cgi-bin/"
</IfModule>
また、サブディレクトリにアクセスして正常にログインすると、ルート/ドメインレベルに戻ることができ、500エラーなしで正常に読み込まれます。