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

buster84

macrumors 6502
Original poster
Oct 7, 2013
428
156
FYI I'm a total noob when it comes to websites :D. I have a mac pro desktop that i use as my media center and i recently decided that i want to be able to send links of my files to friends for them to download so i bought a domain name, bought osx server for mavericks and installed everything.

So far i was able to create a homepage on my computer and when i loaded up my domain name it worked. Then I created a folder for my files and they are all fully accessible though the domain as well and download fine, but its to open to the public which i don't like.

So i created a .htaccess file to password protect my files

AuthType Basic
AuthName "Files"
AuthUserFile /Volumes/2TB/users/.htpasswd
Require valid-user

Then created the .htpasswd and stuck it in a directory (outside my main website directory but when ever i click the to download a file i get 500 internal server error instead of a request for a username/pass. I don't understand whats wrong since i checked "allow overrides using .htaccess files" in the advanced settings. I get the feeling that checking that little box isn't cutting it when it sure seems like it should...

I have my site on a dedicated hard drive and i tried directing the .htaccess file to the .htpasswd file by the above link (in quote) and by "/2TB/users/.htpasswd" and "/users/.htpasswd" and i still get 500 internal error. Either I'm messing up on the directory location or something else is going on here. All the files are on the same hard drive as well.

All i want to do is to be able to send a link to a friend in an e-mail with a username and password and allow him to click the link, enter his username and pass and download the file, but for the life of me i just can't get it to work.

What am i doing wrong? How can i fix this and get the username and passwords to work?
 
(NB: you mentioned a media centre - I'm going to assume we are talking about sharing your own home-made videos, fair-use parodies etc. and not copyrighted movies and TV shows, OK?)

Run Applications/Utilities/Console or use the 'Logs' panel in Server and look at the error log for the web server. Probably, you'll see a message somewhere saying that the .htpasswd file couldn't be read.

i tried directing the .htaccess file to the .htpasswd file by the above link (in quote) and by "/2TB/users/.htpasswd" and "/users/.htpasswd" and i still get 500 internal error.

Well, not knowing where the actual file is is a bad start. It will almost certainly be /Volumes/2TB/something... Open Terminal, and type:
Code:
cat /Volumes/2TB/users/.htpasswd

...or whatever you think the pathname is.

The .htpasswd file also needs to be readable by the web server user. At the level you're working at, you might as well just make it readable (but not writeable) by everybody.

All i want to do is to be able to send a link to a friend in an e-mail with a username and password and allow him to click the link, enter his username and pass and download the file, but for the life of me i just can't get it to work.

Then use a file-sharing site or cloud service like iCloud, Dropbox, Google Drive etc.

Seriously - if you're doing this purely for the sake of experimentation and to learn how to create your own websites, cool, but if practical file-sharing is your objective then running a HTTP server from your home machine is a bad idea for many reasons, including technical and practical ones that don't revolve around lectures on copyright.

For starters, Basic authentication over unencrypted HTTP is approximately as secure as hanging a cardboard 'Keep Out' sign on your door. Its not so bad if you use HTTPS, but then you're into all the complexity of obtaining certificates.

Secondly, your next problem is going to be getting firewalls on your router to allow HTTP access to your Mac from outside (which, depending on your ISP, may or may not be under your control).

Then, some ISPs specifically prohibit running servers (and may block connections at their end). In some cases this isn't just being mean: ADSL connections are optimised for downloading and have very limited 'upload' bandwidth - running a server over ADSL for anything more than personal use or experimentation just isn't cricket.

In fact, these days, its unusual to get a static IP address with basic Internet - I assume that, if you registered a domain, you do have a static IP address (if not, your domain may stop working next time you restart your router!)

Do go ahead and experiment, but if you want to run a website go to a web hosting provider. And whatever you think about the current state of copyright law, sharing movies and TV over your home internet connection is a very, very stupid thing to do (apologies if that wasn't your intent).
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.