Apache: Invalid command 'AuthUserFile' и ошибка Internal Server Error

Автор: | 19/09/2012
 

Многим знакома ошибка:

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

В данном случае – напоролся на грабли своей же “оптимизации” Apache.

Проверяем лог:

[Wed Sep 19 10:36:40 2012] [alert] [client 195.3.205.2] /usr/local/www/users/example/example.co.ua/st/.htaccess: Invalid command ‘AuthUserFile’, perhaps misspelled or defined by a module not included in the server configuration

Самое интересное вот это:

misspelled or defined by a module not included in the server configuration

Проверям загруженные модули Apache:

# httpd -M | grep auth
Syntax OK
authn_default_module (shared)
authn_alias_module (shared)
authz_host_module (shared)
authz_groupfile_module (shared)
authz_user_module (shared)
authz_owner_module (shared)
authz_default_module (shared)
auth_basic_module (shared)
auth_digest_module (shared)

Для корретной работы авторизации через .htaccess требуется модуль authn_file_module. Проверяем содержимое /usr/local/etc/apache22/httpd.conf и находим строку:

#LoadModule authn_file_module libexec/apache22/mod_authn_file.so

Убираем комментарий # и перезагружаем Apache:

# apachectl -t
Syntax OK
# apachectl restart

Проблема решена.