如何在Apache 2.2中完成"AuthType None"

Tec*_*ati 40 authentication apache2.2

http://httpd.apache.org/docs/trunk/mod/mod_authn_core.html#authtype谈论"AuthType None",并且有一个很棒的例子,说明我需要做什么 - 不幸的是,它似乎是2.3的新功能/2.4.2.2中有没有相同的功能?

身份验证类型无禁用身份验证.启用身份验证后,除非指定了其他身份验证类型,否则通常会由每个后续配置节继承.如果对经过身份验证的部分的子部分不需要身份验证,则可以使用身份验证类型None; 在以下示例中,客户端可以访问/ www/docs/public目录而无需进行身份验证:

<Directory /www/docs> 
AuthType Basic
AuthName Documents
AuthBasicProvider file
AuthUserFile /usr/local/apache/passwd/passwords
Require valid-user 
</Directory>

<Directory /www/docs/public>
AuthType None
Require all granted
</Directory>
Run Code Online (Sandbox Code Playgroud)

Fra*_*ard 101

下面的东西适用于apache 2.2.我从http://httpd.apache.org/docs/2.2/mod/core.html#require那里得到了它

<Directory /www/docs>
    AuthType Basic
    AuthName Documents
    AuthBasicProvider file
    AuthUserFile /usr/local/apache/passwd/passwords
    Require valid-user 
</Directory>
<Directory /www/docs/public>
    # All access controls and authentication are disabled
    # in this directory
    Satisfy Any
    Allow from all
</Directory>
Run Code Online (Sandbox Code Playgroud)

  • @Technorati也许你应该考虑接受一个答案?到目前为止,这个解决方案对我来说很好. (5认同)

小智 8

你只需要设置Allow from all和Satisfy Any

这对我有用:

Alias /example "/opt/example.com"

<Directory "/opt/example.com">
  Options None
  AllowOverride None
  Order allow,deny
  Allow from all
  Satisfy Any
</Directory>
Run Code Online (Sandbox Code Playgroud)


小智 7

<Directory /www/docs/public>
AuthType None
Require all granted
Satisfy Any
</Directory>
Run Code Online (Sandbox Code Playgroud)

这会奏效