运行Apache / Linux的AWS EC2中的密码保护目录

编程入门 行业动态 更新时间:2024-10-09 16:24:23
本文介绍了运行Apache / Linux的AWS EC2中的密码保护目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

正如标题所述,我有一个带有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中的密码保护目录

本文发布于:2023-11-01 01:10:54,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1547811.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:密码保护   目录   Linux   Apache   AWS

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!