Ubuntu

無效的命令“AuthType”,可能拼寫錯誤或由未包含在伺服器配置中的模組定義

  • March 23, 2017

我正在嘗試用密碼保護文件根目錄,而我得到的只是一個“內部伺服器錯誤”頁面。Apache 錯誤日誌顯示:

Invalid command 'AuthType', perhaps misspelled or defined by a module not included in the server configuration

在任何重寫條目之前我的 .htaccess 文件:

AuthType Basic
AuthName "Restricted Access"
AuthBasicProvider file
AuthUserFile /var/www/public/.htpasswd
Require user dean

我檢查了模組是否已啟用:

Array ( 
   [0] => core 
   [1] => mod_so
   [2] => mod_watchdog 
   [3] => http_core 
   [4] => mod_log_config 
   [5] => mod_logio 
   [6] => mod_version 
   [7] => mod_unixd 
   [8] => mod_access_compat 
   [9] => mod_alias 
   [10] => mod_auth_basic 
   [11] => mod_authn_file 
   [12] => mod_authz_core 
   [13] => mod_authz_groupfile 
   [14] => mod_authz_host 
   [15] => mod_authz_user 
   [16] => mod_autoindex 
   [17] => mod_cgi 
   [18] => mod_dav 
   [19] => mod_dav_fs 
   [20] => mod_deflate 
   [21] => mod_dir 
   [22] => mod_env 
   [23] => mod_filter 
   [24] => mod_mime 
   [25] => mod_negotiation 
   [26] => mod_php5 
   [27] => prefork 
   [28] => mod_reqtimeout 
   [29] => mod_rewrite 
   [30] => mod_setenvif 
   [31] => mod_socache_shmcb 
   [32] => mod_ssl 
)

我的 Apache 版本是 Ubuntu 14.04 上的 2.4.10

似乎這AuthType是由mod_authn_coreApache 2.4 提供的。我沒有在您提供的列表中看到該模組。

我正在使用Server version: Apache/2.2.15,我在啟動伺服器時遇到了同樣的錯誤。

我啟用了模組mod_authn_filemod_auth_basic. 現在工作正常!

引用自:https://serverfault.com/questions/616154