Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

zimv20

macrumors 601
Original poster
Jul 18, 2002
4,402
11
toronto
i've generated my password file w/ the htpasswd command.

my .htaccess file looks like this:
Code:
AuthUserFile /Users/zim/Sites/.htpasswd
AuthName ByPassword
AuthType Basic
Require valid-user

i've removed index.html from ~/Sites. when i browse to http://127.0.0.1/~zim, i get a directory listing, but no user/password challenge.

this is my first foray into apache. i've made no changes to the default install (i'm on osx 10.2.6). here's some apache info:
Code:
[~] > httpd -V
Server version: Apache/1.3.27 (Darwin)
Server built:   01/15/03 19:22:17
Server's Module Magic Number: 19990320:13
Server compiled with....
 -D EAPI
 -D HAVE_MMAP
 -D USE_MMAP_SCOREBOARD
 -D USE_MMAP_FILES
 -D HAVE_FCNTL_SERIALIZED_ACCEPT
 -D HAVE_FLOCK_SERIALIZED_ACCEPT
 -D SINGLE_LISTEN_UNSERIALIZED_ACCEPT
 -D HARD_SERVER_LIMIT=2048
 -D HTTPD_ROOT="/usr"
 -D SUEXEC_BIN="/usr/sbin/suexec"
 -D DEFAULT_PIDLOG="/var/run/httpd.pid"
 -D DEFAULT_SCOREBOARD="/var/run/httpd.scoreboard"
 -D DEFAULT_LOCKFILE="/var/run/httpd.lock"
 -D DEFAULT_ERRORLOG="/var/log/httpd/error_log"
 -D TYPES_CONFIG_FILE="/etc/httpd/mime.types"
 -D SERVER_CONFIG_FILE="/etc/httpd/httpd.conf"
 -D ACCESS_CONFIG_FILE="/etc/httpd/access.conf"
 -D RESOURCE_CONFIG_FILE="/etc/httpd/srm.conf"

obviously, i'd like to get the password challenge working. anyone have any ideas?
 

zimv20

macrumors 601
Original poster
Jul 18, 2002
4,402
11
toronto
next part --

i want to be able to hit my machine remotely and get to ~/Documents. i've gotten htaccess working in /Library/WebServer/Documents and made a symbolic link (ln -s) from there to my Documents directory.

Code:
% pwd
/Library/WebServer/Documents
% ls -l D*
lrwxrwxr-x 1 root admin 20 Jul 8 00:05 Documents@ -> /Users/zim/Documents
%

when i try to browse to Documents, i get "Forbidden / You don't have permission to access /Documents/ on this server."

i stuck my .htaccess file into that directory, but same thing.

any ideas?
 

zimv20

macrumors 601
Original poster
Jul 18, 2002
4,402
11
toronto
okay, i'm a dork for answering my own questions. but hey, maybe it can help someone else.

to access your Documents folder using http:

1. forget the Documents linking thing

2. but do everything else above

3. in /etc/httpd/users/<username>.conf, make it like this (substitute your username, obviously):
Code:
Alias /~zim/ "/Users/zim/Documents"
<Directory "/Users/zim/Documents/">
    Options Indexes MultiViews
    AllowOverride AuthConfig
    Order allow,deny
    Allow from all
</Directory>
4. stick your .htaccess file in ~/Documents. contents of mine:
Code:
AuthUserFile /Library/WebServer/.htpasswd
AuthName ByPassword
AuthType Basic
Require valid-user
(notice i moved my password file)

5. chmod 755 ~/Documents
 

Rower_CPU

Moderator emeritus
Oct 5, 2001
11,219
2
San Diego, CA
Have you checked the directory permissions? By default, your Documents directory is set to only be readable by you (for security on your local machine).

Try chmodding that sucker...

[edit: Nevermind. :)]
 

zimv20

macrumors 601
Original poster
Jul 18, 2002
4,402
11
toronto
okay, i think this is it.

i cannot browse below ~/Documents by going to 127.0.0.1/~zim. but i can browse freely by going to 127.0.0.1.

dunno what the deal is, but at least i have a solution. and what i said above about ditching the link at /Library/WebServer/Documents/Documents should be ignored. it's needed.

wasn't this fun? :)
 

zimv20

macrumors 601
Original poster
Jul 18, 2002
4,402
11
toronto
Originally posted by EdSchouten
you could edit the httpd.conf to search for htaccess instead of .htaccess :)

i kept all my .ht files hidden, by design. i apologize if i implied i was using "htaccess" instead of ".htaccess".
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.