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

motulist

macrumors 601
Original poster
Dec 2, 2003
4,236
611
I turned on the Apache web server that's built into OSX, but when I put an alias to a folder into the "Sites" folder, then the web page treats it as a file instead of a symbolic link to the folder I'm trying to specify.

background: I just got an ipod touch 8 gig for free with the purchase of my laptop, and I want to be able to send any of my 250 GB worth of music to it at any time. I turned on OS X's file sharing and web sharing, and I can access my mac's webpage from my Touch, and if there are any *actual* files and folders inside the "Sites" folder then I can navigate and download all those files and folders perfectly from my Touch using the Touch's Safari browser. That's all fine, but my albums are on an external hard disk, and when I put an alias to my albums folder into the "Sites" folder, then I can't navigate to that folder from the Touch's safari.

How do I make an alias in unix / apache so I can get to the files on my external hard drive through my Mac's Apache webpage?
 
It's late and I'm really tired. If I didn't explain what I'm talking about well enough, then just ask me to clarify.
 
Drop to terminal, and create a link using the ln command.


ln -s /var/www/html/username/mp3/ /my/mp3/directory/
 
I don't quite follow what you mean. I don't see where this "var" folder is that you're talking about.

When I drag and drop the folders onto the terminal window, here's the directory path it shows for the "Sites" folder that OS X's web server runs from:

Code:
/Users/xxxxxx/Sites/



And here's where my albums are on my connected external hard drive:

Code:
/Volumes/biggie/albums


So what should I type into the terminal to make a symbolic link (alias) in my "Sites" folder that will then open up my albums folder?

.
 
Also, another issue I'm having is that web page showing the files in the directory is only showing very short files names. How do I make the web page's directory listing show the entire file names?
 
i cheat and use air foil speakers and remote to play the 162gb of music from my mp i stick airfoil in the background and fire up remote whenever i want to listen:D
 
i cheat and use air foil speakers and remote to play the 162gb of music from my mp i stick airfoil in the background and fire up remote whenever i want to listen:D

Well, that's nice as long as you want to hear your music in the room next door, but that's all. Plus, that costs a significant amount of monies. What I'm trying to do is a really super useful and super easy solution, I just need to know how to make this folder alias!
 

Thanks so much, this is exactly my issue! I believe that that's what I previously had tried typing into the terminal (see my above post) using dragging and dropping to get the exact folder locations into the terminal's command line, but it didn't work for a reason that I can't remember at the moment. I'll try this again later and I'll report back if it works or not.

p.s., in the mean time I found the app StreamToMe which basically does exactly what I wanted to achieve, in fact in many ways it does it better than the solution I was trying to build. The only problem with it is that it only works over my computer's local wifi, and that's a big problem. So I'd still like to get the OS X web serving solution to work too.
 
Since the article does not tell you why it doesn't work...
It's quite easy, an alias and a symbolic link are somewhat the same thing. The only real differences between the two: an alias is a Finder thing and a symbolic link is a unix/terminal thing and they are mostly not compatible (i.e. some apps will only understand symbolic links, others only understand Finder's aliases but some will understand both (ironically Finder is one of those...)). Apache is one of the unix/terminal things on a Mac and only understands symbolic links. Aliases in Apache are something completely different (take a look at the Apache documentation). That's why it doesn't work and why things are a bit confusing.

It is absolutely ridiculous we have aliases and symbolic links in the first place, too confusing. Apple should just use symbolic links instead, it's what most applications will be compatible with (which is a bit of an educated guess btw).
 
So, I did EXACTLY what that Apple Support document said to do, but it still doesn't work. Here are the screenshots of exactly what I did, and exactly what the results were. WHY DOESN'T THIS WORK?!!?! Someone must know how to make this very simple function work!
 

Attachments

  • 1 - terminal.png
    1 - terminal.png
    10.9 KB · Views: 651
  • 2 - directory result.png
    2 - directory result.png
    42.5 KB · Views: 435
  • 3 - web result.png
    3 - web result.png
    24.3 KB · Views: 368
If you google for something like "osx symbolic link support apache" you'll get a lot of results with howto's on the subject. One of those can be found below, you might want to take a look at those and compare them with your own configuration.

- http://www.rchu.nl/2009/09/os-x-apache-and-symbolic-links/
- http://abaff.wordpress.com/2008/03/19/problems-with-os-x-leopard-apache-and-symbolic-links/ (take a look at the comments)

Also be sure to check the permissions for the files, folders and symbolic link. A lot of Apache problems are caused by not having the correct permissions.
 
If you google for something like "osx symbolic link support apache" you'll get a lot of results with howto's on the subject. One of those can be found below, you might want to take a look at those and compare them with your own configuration.

- http://www.rchu.nl/2009/09/os-x-apache-and-symbolic-links/
- http://abaff.wordpress.com/2008/03/19/problems-with-os-x-leopard-apache-and-symbolic-links/ (take a look at the comments)

Also be sure to check the permissions for the files, folders and symbolic link. A lot of Apache problems are caused by not having the correct permissions.

Thanks for the info links, but they are totally over my head. I went into the finder and the permissions on my Albums folder was already set to "Read and Write" for all the groups, and I hit "apply to all enclosed items" but that didn't fix the problem.

I tried to read and understand the info in those links you posted, but it's completely over my head. Would it be possible for you to explain to me exactly what I should type into the terminal to follow the instructions they're trying to describe there? I mean, they say things like:

"edit the /etc/apache2/users/username.conf.

Add FollowSymLinks to the Options."

Huh wha??? I know I'm asking a lot, but I've tried to figure it out myself without success. Help?
 
In the /etc/apache2/users/<username>.conf you should have something like this:

Code:
<Directory "Users/<username>/Sites/">
  Options Indexes MultiViews FollowSymLinks
  AllowOverride None
  Order allow,deny
  Allow from all
</Directory>

The <username> should be replaced with your own username. Editing the file can be done by using the following command in Terminal:
sudo open -e /etc/apache2/users/<username>.conf. This will open Text Editor with the file so you can edit it. Since this is a system file you need to do this as an admin (which is a type of account with full rights). The sudo part of the command allows you to do this (it actually tells the OS that whatever follows needs to be run as admin). When asked for a password you need to enter the password for your account. Simply add the "FollowSymLinks" where it needs to be and save & close the file. Now you need to restart Apache which can be easily done by disable web sharing and enabling it again.

You also need to check the permissions for /Users/<username> (aka your entire user homedir). The usergroup "everyone" needs to have read only access to all the enclosed items. There are some tools which allow you to make your homedir more secure. They do this by removing the read only access for the "everyone" group. By doing so they also break your webserving gear.

However, if things are way above your head it might be a better idea to get someone to do this for you or use something different. There is an all-in-one tool that gets you going quickly and it's called MAMP.
 
In the /etc/apache2/users/<username>.conf you should have something like this <snip>

Thanks so much! I'll give this a try sometime in the next few days and I'll report the results either way.
 
In the /etc/apache2/users/<username>.conf you should have something like this

DUDE!!!!! YOU RULE!!!!!!!!!! IT WORKED!!!!!!!!! :D :eek: :D:D :) :D

Your instructions were PERFECT!

Now even though I only have an 8 GB iPod Touch, I still have full access to all my 250 GBs of music!!!! Thank you soooooo much! You totally made my life better! :D
 
In the /etc/apache2/users/<username>.conf you should have something like this

You taught a man to fish! I wanted to make the webpage directory listing show the full file name instead of truncating the name to 32 characters, so I googled and found the text I had to insert to the configuration file to make that happen, and I was able to add that to the config file, and it worked! Now it shows the full file name on the webpage! Thanks again!
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.