Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Is there a way to symbolically link a directory using ln to my ~/Sites/ directory on OS X so that the permissions are correct so it may be viewed in a web browser when I'm doing web development on a local machine?

This is what I did ln -s ~/code/web/yolkportfolio ~/Sites/yolkportfolio I then chmod 755 on the directory but it still isn't readable.

Any help would be greatly appreciated.

share|improve this question
    
What are the permissons on the link? –  sbtkd85 Aug 22 '11 at 17:33
    
755 are the permissions. –  yolk Aug 22 '11 at 22:19

2 Answers 2

up vote 2 down vote accepted

The problem was with my apache config. Here is what allowed it to work, just the FollowSymLinks rule.

<Directory "/Users/Joe/Sites/">
    Options Indexes MultiViews FollowSymLinks
    AllowOverride None
    Order allow,deny
    Allow from all
</Directory>
share|improve this answer

You have a couple of options:

1. If you are running apache with a different user (not yours), and definitively want the DocumentRoot to point to some directory inside your home, you meed to change permissions to your home directory (defaults must be 750 or 700) to 755

I'd only recommend this if this is your laptop or your personal computer and no one else has access to it.

2. The first one is not an option but you still want the DocumentRoot inside your home, then you can change the user who runs apache. Edit its configuration file and look for directives User and Group.

3. Second one is still not an option, and still ... you want things inside your home. Use apache's mod_userdir. With the following configuration:

<IfModule mod_userdir.c>
        UserDir public_html
        UserDir disabled root

        <Directory /home/*/public_html>
                AllowOverride FileInfo AuthConfig Limit Indexes
                Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
                <Limit GET POST OPTIONS>
                        Order allow,deny
                        Allow from all
                </Limit>
                <LimitExcept GET POST OPTIONS>
                        Order deny,allow
                        Deny from all
                </LimitExcept>
        </Directory>
</IfModule>

This is the default configuration for Apache's mod_userdir on Debian. You will be able to access:

/home/your-username/public_html/*

on your browser at the following address:

http://somewhere/your-username/*

4. Finally, you could place DocumentRoot somewhere else (/srv/www, /opt/www or whatever) and setup permissions as needed.

share|improve this answer
    
I've done what you said with permissions but I'm still getting problems while trying to access the directory. I still get 403: Forbidden –  yolk Aug 24 '11 at 15:15
    
Can you post your apache's config files ? –  Torian Aug 24 '11 at 16:22
    
My apache config file may be seen here. –  yolk Aug 25 '11 at 17:28
    
Post the exact command you used to change permissions –  Torian Aug 25 '11 at 18:16
    
chmod -R 755 ~/Sites/yolkportfolio/ which is symlinked to my ~/code directory. –  yolk Aug 26 '11 at 20:34

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.