密码保护我的网站 [英] Password Protect My Website
问题描述
我最近在使用亚马逊的Linux AMI一个新的Amazon EC2实例。什么是强制用户访问域名,允许访问网站之前输入用户名/密码的最佳方式?
I have recently created a new Amazon EC2 instance using Amazon Linux AMI. What is the best way to force a user accessing the domain to enter a username/password before allowing access to the site?
我目前使用Apache HTTP服务器,并看到了一些资源,表示我需要使用.htaccess文件,但一直在寻找一个更简洁的解释。
I am currently using apache http server, and saw some resources indicating I need to use a .htaccess file, but was looking for a more concise explanation.
推荐答案
如果你正在寻找的是服务器级别的访问控制(即没有修改您的应用程序),你可以使用基本身份验证。这是在Apache网页服务器级别上实现,并且可以使用.htaccess文件,如果需要的话上的目录,通过目录基础上进行控制。
If all you are looking for is server-level access control (i.e. no modifications to your application), you can utilize basic authentication. This is implemented at the Apache web-server level and can be controlled on a directory-by-directory basis if desired using .htaccess files.
下面是一个链接到Apache文档
Here is a link to the Apache documentation
http://httpd.apache.org/docs/2.2/howto/ auth.html
下面是如何实现一个简单的例子
Here is a simple example of how to implement
http://doc.norang.ca/apache-basic-auth.html
这篇关于密码保护我的网站的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!