Creating a symbolic link in Sites directory

后端 未结 6 481
遇见更好的自我
遇见更好的自我 2020-12-22 18:54

I have a file in my ~/Sites directory that works fine when I browse to it through coderama.local/~coderama/index2.php

Now I want to get tri

相关标签:
6条回答
  • 2020-12-22 19:15

    Seems like a security issue (also suggested by Matt)

    http://discussions.apple.com/thread.jspa?threadID=1771399

    0 讨论(0)
  • 2020-12-22 19:21

    Had the same issue. Unfortunately, Marvo's answer wasn't enough.

    The problem lies with the permissions set on every folder in the path, starting from ~/. The directories needs the execute flag set to be able to recurse the directory tree. So, in my case, I symlinked a theme folder from ~/Dropbox/projects/theme to a wordpress install on ~/Site/wordpress.

    The answer was:

    chmod a+x ~/Dropbox/
    chmod a+rx ~/Dropbox/projects
    

    This is an old issue, but if anyone reaches this page, it might be useful. :)

    0 讨论(0)
  • 2020-12-22 19:23

    Also make sure you have a directive in your httpd-vhosts.conf

    Otherwise you get the same '403 forbidden in the browser', with 'the client denied by server configuration in the error log.

    0 讨论(0)
  • 2020-12-22 19:28

    I don't remember the specific reason why, but it doesn't work. It's a security issue. You can use XAMPP http://www.apachefriends.org/en/xampp-macosx.html or MAMP http://www.mamp.info/en/index.html to get around this.

    0 讨论(0)
  • 2020-12-22 19:35

    That's a configurable Apache option. It appears that by default on Macs (and probably most installations) Apache is configured to not follow symbolic links. I'm guessing (as others mention above) that it's for security purposes.

    But it can be really convenient at times to enable following of symbolic links, particularly during development of certain kinds of apps. What you need to do is 1) change the Apache configuration to allow the following of symbolic links, and then 2) restart Apache.

    The configuration step is performed as follows:

    a) cd /etc/apache2 (this is where Apache's configuration files are by default on a Mac)

    b) you'll see a couple of directories here. One is called users

    c) cd users

    d) ls should reveal a .conf file with your login name (login.conf) I'm "marvo" so mine is named "marvo.conf"

    e) Edit this file (I use vi) -- but you have to do it using sudo:

    sudo vi marvo.conf
    

    f) You'll see something like

    <Directory "/Users/marvo/Sites/">
        Options Indexes MultiViews 
        AllowOverride None
        Order allow,deny
        Allow from all
    </Directory>
    

    g) Add the "FollowSymLinks" option so that the second line of that .conf file looks like:

    Options Indexes MultiViews FollowSymLinks
    

    (You can find other configuration options out there on the 'net. I found this page: http://httpd.apache.org/docs/2.0/mod/core.html#directory )

    h) Save the file.

    Now you have to restart Apache so that it picks up the configuration change. Googling around a bit, I found that this is most easily done from the command line with the following command:

    sudo /usr/sbin/apachectl restart
    

    (Found that at http://mcapewell.wordpress.com/2006/09/22/restart-apache-in-mac-os-x/ )

    Now that symbolic link should work just fine on your Sites pages.

    0 讨论(0)
  • 2020-12-22 19:39

    In addition to Marvo's answer. What helped me was to Change the permission on Documents folder:

    cd ~
    chmod a+rx Documents/
    
    0 讨论(0)
提交回复
热议问题