简体   繁体   English

Apache 2.4,Windows 10和受密码保护的目录

[英]Apache 2.4, Windows 10 and password protected directories

I've been trying to install password protection in a subdirectory of my Apache 2.4 (Windows 10) htdocs directory. 我一直在尝试在Apache 2.4(Windows 10)htdocs目录的子目录中安装密码保护。

I started with an external .htaccess file and migrated to adding the data to a entyr in the httpd.conf file. 我从外部.htaccess文件开始,然后迁移到将数据添加到httpd.conf文件中的整个条目中。

I place the .htpasswd file in the directory above htdocs (root?) and refer to the directory as '/.htaccess'. 我将.htpasswd文件放在htdocs(根目录?)上方的目录中,并将该目录称为“ /.htaccess”。 I ran Process Monitor (formerly from SysInternals) and know the .htpasswd and .htaccess files were being found and read. 我运行了Process Monitor(以前来自SysInternals),并且知道正在查找和读取.htpasswd和.htaccess文件。

I access the protected directory using three different addresses:127.0.0.1(localhost);192.168.0.101; 我使用三个不同的地址访问受保护的目录:127.0.0.1(localhost); 192.168.0.101; and 'jimjulian.ddns.net'. 和“ jimjulian.ddns.net”。

In each case, the password form pops up once, I fill out the form, get entry and close. 在每种情况下,都会弹出一次密码表单,我填写该表单,然后输入并关闭。 In each case, I have access from then on, without the form. 在每种情况下,我从那时起都可以访问,而无需使用表格。

I tried erasing the browser (Chrome) cache, but to no end. 我尝试删除浏览器(Chrome)缓存,但一直没有结束。

Is there anything I've overlooked? 有什么我忽略的吗? Anything I can try? 我有什么可以尝试的吗?

.htaccess contents: .htaccess内容:

AuthType Basic
AuthName 'Area51'
AuthUserFile 'C:\Apache24\.htpasswd'
require valid-user

I wasn't sure what to do with the AllowOverride. 我不确定该如何处理AllowOverride。 Seemed to me, the default setting, None, would nullify the contents of the .htaccess So I set that to All in the conf file 在我看来,默认设置“无”将使.htaccess的内容无效,因此我在conf文件中将其设置为“全部”。

Two revelations solved the problem. 有两个启示解决了这个问题。 My dns updater for No-IP was not running. 我的No-IP的dns更新程序未运行。 Even though I cleared the browsing history and cache regularly, I didn't realize until just now, and after installing another browser for comparisons, that passwords and usernames were being held the length of the session. 即使我定期清除浏览历史记录和缓存,但直到现在我才意识到,在安装了另一个浏览器进行比较之后,密码和用户名在会话期间一直保持不变。 Once I closed the browser and reopened, and cleared the cache again, the password popup, popped up. 关闭浏览器并重新打开,然后再次清除缓存后,将弹出密码弹出窗口。 Perhaps this will benefit someone. 也许这会使某人受益。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM