3

I'm setting up a development server and need to apply these basic rules to all virtual hosts on the server in the /var/www/html directory.

AuthType Basic
AuthName "Development Area"
AuthUserFile /var/www/.htpasswd
Require valid-user

I simply tried to put it in my httpd.conf, However apache throws an error when checking the syntax: AuthType not allowed here

Dunhamzzz
  • 187
  • 6

1 Answers1

4

Authentication always applies to a context; this may be a VirtualHost, a Directory, or a Location.

<Location />
AuthType Basic
AuthName "Development Area"
AuthUserFile /var/www/.htpasswd
Require valid-user
</Location />
adaptr
  • 16,479
  • 21
  • 33
  • Many thanks, after some investigation I need this to work only on sites in the `/var/www/html` directory, is that possible? (also you don't need the `/` in the closing tag) – Dunhamzzz Nov 16 '12 at 12:26
  • THanks I've worked it out, just needed to use `` – Dunhamzzz Nov 16 '12 at 12:31
  • Refer to the documentation for details on how these directives interact with each other: http://httpd.apache.org/docs/2.2/sections.html#file-and-web – adaptr Nov 16 '12 at 12:38