Limit access to certain directories:


 AllowOverride AuthConfig

in your config section in httpd.conf or where you define your servers.

In the limited directory add the .htaccess file with the following content

 AuthType Basic
 AuthName "Password Required"
 AuthUserFile /full_path_to/.htpasswd
 Require valid-user

Maintain .htpasswd with htpasswd:

htpasswd -c -b ./htpasswd username password - creates the password file, without -c you need existing one.

Test it here with testuser:testit

Apache2 does not come up at the boot process.

Edit the /etc/init.d/apache2 and comment out the following lines

 if [ "$NO_START" != "0" -a "$1" != "stop" ]; then
   [ "$VERBOSE" != no ] && log_warning_msg "Not starting apache2 - edit /etc/default/apache2 and change NO_START to be 0.";
     exit 0;

Even if NO_START=0 is set it stops here. Why? I dont know.

Works fine for me, is there a symlink in /etc/rc?.d for the correct runlevel? (Carsten)

DocumentationForm edit

Title How to limit access to certain directories on Apache
Description This page shows how to limit access to certain directories on Apache.
Tags apache access limit
Category Admin
This topic: ATLAS > WebHome > GeneralDocumentation > Apache
Topic revision: 10 Feb 2012, ArthurVarkentin
This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding Foswiki? Send feedback