Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I just installed Apache Web Server on Ubuntu 11.04 in VMWare Workstation. I created a basic HTML page, named it index.html and placed it in /var/www directory (document root).

I am able to access this web page from my Host OS (Windows 7), by pointing the browser to:

where, is the IP Address of the Ubuntu VM.

Next, to test various configurations of .htaccess files, I created a new directory in /var/www called, members.

Inside this directory, I created and placed a .htaccess file with the following configuration:

AuthUserFile /www/Neon/auth/.htpasswd
AuthName "neon's home"
AuthType Basic
require valid-user
IndexIgnore */*

I created a directory path like /var/www/Neon/auth/

and then placed a .htpasswd file inside it.

To place the username and hash inside the .htpasswd file: I created a username "neon" and calculated the DES hash of a password and placed it inside .htpasswd file in format:


Now, when I try to access the web page:

It does not prompt me to enter the username and password with a popup box. Instead it just displays the index.html which is placed inside members directory.

I would like to get this configuration working :)

share|improve this question

First guess: you are missing the AuthGroupFile which may be set to /dev/null to disable all group functionality.

Other guess: look in the error_log for the specific server/vhost.

share|improve this answer
Ok. I will check it. Thanks. There is only one document root in the VM. I have not hosted multiple sites. The HTML pages are placed in the default document root, /var/www. So, I did not understand what you mean by specific server/vhost in my configuration? Can you elaborate over that? – Neon Flash Oct 3 '12 at 3:33
I'm used to configurations with lots of virtualhosts with an ErrorLog directive per virtual host, so that will take some searching finding the 'right' logfile. In your case, their is only one place to search, the main ErrorLog. – Koos van den Hout Oct 5 '12 at 11:06

I would suggest using Apache's built-in tool for generating the htpasswd entries.

htpasswd -c /www/Neon/auth/.htpasswd username

This will create the .htpasswd file for you. When you go to add a new username to that file, omit the -c option and it will append new entries to it.

share|improve this answer

Check this site:

It can help you generate a correct .htpasswd file.

Are you sure that in you site conf /etc/apache2/sites-avaliable (if you are using apache) there is the directive "AllowOverride All"? If not, the .htaccess will be ignored from apache.

Sorry for bad english, but I'm italian.

share|improve this answer
Hi. I think my .htpasswd file is correct. Do I need to edit, /etc/apache2/apache2.conf file? I tried adding the AllowOverride All directive. However, when I restart apache using, /etc/init.d/apache2 restart, I get the error: "Syntax error on line 176 of /etc/apache2/apache2.conf: AllowOverride not allowed here ". can you give a sample configuration? My .htaccess file is in the, /var/www/members/ location. – Neon Flash Oct 2 '12 at 8:48
Ok, I found and edited, the /etc/apache2/sites-available/default file. In the Directory Section for /var/www/, I added, AllowOverride All and restarted Apache Web Server. Now, when try to access the members directory, I am prompted to enter the username and password. However, after I enter the correct username and password, I get Internal Server Error. Any suggestions? The hash and salt are correct. – Neon Flash Oct 2 '12 at 8:59

Any chance the problem is that you've told Apache to look for the file in /www/Neon/auth/ and you've actually created the file in /var/www/Neon/auth? Put differently, what reason do you have to think Apache understands that the www/Neon/ directory is inside /var/ and not at the filesystem root?

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.