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

pezmannen

macrumors newbie
Original poster
Jan 23, 2010
10
0
Hi

This is my first post at MacRumors (long time reader though), so please be kind and helpfull :)

I recently bought my first Mac (mac mini) and I'm lovin it. Yesterday I tried iWeb and made a site containing photos of me and my friends. I'm not that enthustiastic about MobileMe (expensive) and would rather host the site on my own mac mini.

In iWeb, it's only possible to password protect sites that you upload to MobileMe. But as I understand it, the built-in web server is an Apache server? Shouldn't I be able to password my locally hosted site by using functions in Apache?

If anybody has a good guide I'd appriciate it!

Thanks
 
I've created the .htpasswd-file and the .htaccess file but it doesn'nt work. Do I need to activate them?
 
One of the typical problems run into is not using the correct full path to the htpasswd file. In the .htaccess file, you've got a line like,
Code:
AuthUserFile /full/path/to/.htpasswd

That path has the be the full path for the system, not just your web zone. If it's on a Linux server it'll likely have the form

Code:
/home/username/.htpasswd
To get the full path, if you SHH into your domain, is to run the command pwd (it may be cwd (current working directory) on some systems).

If that isn't the issue we'll need to know more about what you tried. They don't need activating though. Apache looks for the .htaccess file at each file request.
 
I downloaded Mamp and it worked out of the box. This should mean that I got the files correct I think?
 
My point was that Mamp uses the htaccess and htpasswd-files correctly...


This is my .htaccess file

In my .htaccess (which is placed in /Users/MyUser/Sites/MySite
AuthUserFile(placed in folder above /MySite) /Users/MyUser/Sites/.htpasswd
 
My point was that Mamp uses the htaccess and htpasswd-files correctly...


This is my .htaccess file

In my .htaccess (which is placed in /Users/MyUser/Sites/MySite
AuthUserFile(placed in folder above /MySite) /Users/MyUser/Sites/.htpasswd

Yes, MAMP includes Apache and unless something changed recently, it does load .htaccess

Where is the rest of your .htaccess file? You need something like this...

Code:
AuthUserFile /full/path/to/.htpasswd
AuthType Basic
AuthName "My Secret Folder"
Require valid-user
 
Try this... drop in to Terminal and run the following commands to make sure that the files are indeed named and in place where you think they are...

Code:
cd /Users/MyUser/Sites/MySite
cat .htaccess

then

Code:
cat /Users/MyUser/Sites/.htpasswd

If everything appears in order, I could check file permissions and make sure they are readable by the user Apache is running as, but NOT world-writable. (e.g., 777)

Lastly, check the Apache error logs. Mine were at

Code:
tail -n 100 /Applications/MAMP/logs/apache_error_log
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.