8

I'm trying to password protect the document root and all I get is an "internal server error" page. The Apache error log shows:

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

My .htaccess file before any rewrite entries:

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

I checked if the modules were enabled:

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 
)

My Apache version is 2.4.10 on Ubuntu 14.04

chutz
  • 7,569
  • 1
  • 28
  • 57
Dean Or
  • 203
  • 1
  • 2
  • 5

2 Answers2

9

It seems that AuthType is provided by the mod_authn_core in Apache 2.4. I don't see that module loaded in the list you provided.

chutz
  • 7,569
  • 1
  • 28
  • 57
1

I'm using Server version: Apache/2.2.15, I have got the same error while starting server.

I have enabled module mod_authn_file and mod_auth_basic. Works fine now!