正如标题所述,我有一个带有Apache的AWS EC2实例。这是一台Linux服务器。我想用密码保护一个目录。我正在关注以下答案: stackoverflow/a/18178857/989722
As the title says, I have an AWS EC2 instance with Apache. It's a Linux server. I want to password protect one directory. I was following this answer: stackoverflow/a/18178857/989722
htaccess:
AuthType Basic AuthName "Password Protected Area" AuthUserFile /var/www/admin/.htpasswd Require valid-user创建了适当的.htpasswd文件,但想知道是否还有其他步骤。
Created a proper .htpasswd file, but wondering if there's another step.
但是,它不起作用(即,目录不受保护)。我重新启动了服务器,但没有帮助。想知道是否需要更改配置文件中的内容。
However, it's not working (i.e., directory isn't protected). I restarted my server and that didn't help. Wondering if I need to change something in my config file.
如果我使用终端 ls ,则看不到.htaccess文件。我使用SFTP上传了它,并使用我的FTP应用程序看到了它,但实际上可能不存在。我的.htpasswd文件也是如此。
If I look at the contents of the directory where I placed my .htaccess file, using terminal ls, the .htaccess file isn't visible. I uploaded it using SFTP and see it using my FTP application, but maybe it's not actually there. Same thing for my .htpasswd file.
推荐答案愚蠢的错误。
需要将其添加到我的服务器配置文件中:
Needed to add this to my server config file:
<Directory /var/www/html/MYPROTECTEDDIRECTORY> AllowOverride All </Directory>更多推荐
运行Apache / Linux的AWS EC2中的密码保护目录
发布评论