Apache 为什么.htaccess受保护的目录可以在http上工作而不能在https上工作?
我有一个域名Apache 为什么.htaccess受保护的目录可以在http上工作而不能在https上工作?,apache,.htaccess,ubuntu,https,Apache,.htaccess,Ubuntu,Https,我有一个域名example.comexample.com链接到Tumblr博客sub.example.com链接到我家Ubuntu服务器的Apache服务器。我还可以选择在sub.example.com中启用SSL(即,用户可以选择对任何网页使用http或https)sub.example.com/directory受.htaccess保护。我可以在http://sub.example.com/directory,但不在https://sub.example.com/directory。在htt
example.com
example.com
链接到Tumblr博客sub.example.com
链接到我家Ubuntu服务器的Apache服务器。我还可以选择在sub.example.com
中启用SSL(即,用户可以选择对任何网页使用http
或https
)sub.example.com/directory
受.htaccess保护。我可以在http://sub.example.com/directory
,但不在https://sub.example.com/directory
。在https
版本中,系统会提示我输入登录信息。在中输入凭据后,出现以下错误:
错误:找不到文件
找不到文件。
我不确定出了什么问题。下面是完整的/var/www/html/directory/.htaccess
文件和/etc/apache2/apache2.conf
文件的选定部分
.htaccess:
AuthType Basic
AuthName "Password Protected Area"
AuthUserFile /var/www/.htpasswd
Require valid-user
apache2.conf:
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
选项索引跟随符号链接
允许超越所有
要求所有授权
我使用的是Ubuntu 14.10和Apache 2.4.10,请检查以下步骤
就像计算机上的许多事情一样,重启修复了我的问题。所以,我可能没有重新启动一些服务 HTTPS在受保护目录之外工作正常。使用HTTP时,可以使用密码访问该目录。由于HTTPS在
sub.example.com
上运行良好,SSL(大概)配置正确。