O'Reilly logo

Web Development Recipes, 2nd Edition by Chris Johnson, Mike Weber, Chris Warren, Brian P. Hogan

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Recipe 42Securing Your Content

Problem

When we put files on our web server, they’re available for anyone to see. But we don’t want the entire world to have access to any important documents we’re storing. When we want a select group of people to be able to access the files, we need a way to lock certain files or folders and create basic authentication.

Ingredients

  • Development server with Apache

  • Apache2-Utils

Solution

Apache allows us to create configuration files that specify which directories and files shouldn’t be served without authentication. We’ll take a look at how we build these configuration files to secure our server.

Using Basic HTTP Authentication

When Apache is serving up files, it’s always looking for the .htaccess file. This ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required