大网数据广告活动
服务器运维问答

How to enable Apache DIGEST Authentivation everywhere on files and subdirectories

· 52CE 我爱测

I'm trying many different configurations following many tutorials and documentations, I can't get the authentication without creating thousands .htaccess files. Here is my configuration : <VirtualHost *:443> DocumentRoot /home/us…

问题原文

原帖链接 · Nicolas Thery · CC BY-SA 3.0

I'm trying many different configurations following many tutorials and documentations, I can't get the authentication without creating thousands .htaccess files.

Here is my configuration :

<VirtualHost *:443>
 DocumentRoot /home/user/www
 ServerName preprod.user.com
 <Directory /home/user/www>
     Options Indexes SymLinksIfOwnerMatch
     AllowOverride All
     AllowOverride FileInfo AuthConfig Limit
     Require all granted
 </Directory>

 SSLEngine on
 SSLCertificateFile      /etc/ssl/private/preprod.user.com.crt
 SSLCertificateKeyFile /etc/ssl/private/preprod.user.com.key
</VirtualHost>

And at the root level, I wrote this /home/user/www/.htaccess file :

 AuthType DIGEST
 AuthName "preproduction"
 AuthDigestNonceLifetime 1
 AuthDigestDomain "/home/user/www/" "https://preprod.user.com/"
 AuthDigestProvider file
 AuthUserFile "/web/auth/.digest_pw"
 Require valid-user

The result is :

https://preprod.user.com/ asks for a password
https://preprod.user.com/v1/ asks for a password

BUT :

https://preprod.user.com/v1/index.php <strong>doesn't ask for password</strong>

Thank you all

已采纳解答

原帖链接 · Nicolas Thery · CC BY-SA 4.0

I just found a solution :

The problem comes from the files : without telling the files the Authentication applies, it only applies on the directories and files keep served !

<Files *>
         AuthType DIGEST
         AuthName "preproduction"
         AuthDigestNonceLifetime 1
         AuthDigestDomain "https://preprod.user.com/"
         AuthDigestProvider file
         AuthUserFile "/web/auth/.digest_pw"
         Require valid-user
</Files>

Bye !

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2015-11-02)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0 / CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。