problems with require user directive

Discussion in 'Apache' started by greg_brant26, Oct 31, 2007.

  1. #1
    We've got a Linux box in the office which we want to use as a development server for all the sites for one of our clients.

    So using the .staging.local domain that I have set up on our Domain Controller I have set up a pile of sites, configured apache and it all works well

    eg

    http://site1.staging.local

    http://site2.staging.local

    etc etc

    example httpd.conf



    # http://site1.staging.local
    <VirtualHost *>
    ServerName site1.staging.local
    DocumentRoot "/var/www/site1.staging.local"

    <Directory /var/www/site1.staging.local/>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride All
    Order allow,deny
    allow from all
    </Directory>
    </VirtualHost>

    these all work brill.

    So next we want to give external access to these, but with some user authent.

    So I need to put them on different ports (the IT manager says so...)

    so for example

    http://clientName.ourDomain.com:[portnumber]

    so site1 external access httpd.conf looks like this

    Listen 7104

    <VirtualHost *>
    ServerName clientName.ourDomain.com:7104

    DocumentRoot "/var/www/site1.staging.local"

    <Directory /var/www/site1.staging.local/>

    Options FollowSymLinks MultiViews -Indexes
    AllowOverride All
    Order allow,deny
    allow from all

    # external access user
    AuthUserFile /etc/apache2/.htpasswd
    AuthType Basic
    AuthName Protected
    Require user myUserName
    </Directory>
    </VirtualHost>

    now this seems to be working because when you hit



    http://clientName.myDomain.com:7104 it asks you to authenticate.

    I have created the user myUserName with the correct password using

    $root> htpasswd -b /etc/apache2/.htpasswd myUserName correctPassword
    as root on the Linux box.

    ok, so...

    when I put in myUserName/correctPassword for the un/pw it fails, the apache log says

    [Wed Oct 31 10:30:00 2007] [error] [client 192.168.4.1] access to / failed, reason: user myUserName not allowed access

    if I put in myUserName/crap for the un/pw it fails, the apache log says

    [Wed Oct 31 10:32:18 2007] [error] [client 192.168.4.1] user myUserName: authentication failure for "/": Password Mismatch

    and if I put in complete/crap for the un/pw the apache log says

    [Wed Oct 31 11:05:46 2007] [error] [client 192.168.4.1] user complete not found: /

    so it seems that the authent is working its just that I haven't configured it to allow access to the folder by user myUserName but I thought that's what

    AuthUserFile /etc/apache2/.htpasswd
    AuthType Basic
    AuthName Protected
    Require user myUserName

    was supposed to do...

    any thoughts / suggestions welcomed?


    Thanks
    Greg
     
    greg_brant26, Oct 31, 2007 IP