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?
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.
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.
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