Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

So I have an nginx server running on Mac OSX and I am trying to create a symlink in my nginx www directory from somewhere else. In the browser I get the wonderful 403 Forbidden error. I have also tried chmod'ing my life away for the past few hours.

There doesn't seem to be anything on the stack about it. One thing concerns me is that I am not sure if symlinks are directly supported by ngninx on Mac.

Trying to use disable_symlink directive results in:

nginx: [emerg] unknown directive "disable_symlinks" in /usr/local/etc/nginx/nginx.conf:44`


Some info about my setup:
nginx -v : nginx version: nginx/1.4.2


To create the symlink I do the following:

cd /Users/levi/www
ln -s "/Users/levi/Desktop/.../client" "/Users/levi/www/client"


The error in the log:

[error] 11864#0: *7 open() "/Users/levi/www/client" failed (13: Permission denied), client: 127.0.0.1, server: _, request: "GET /client HTTP/1.1", host: "localhost"


Any help is much appreciated. Let me know if there's any more information I can give you.

share|improve this question
add comment

1 Answer

I can verify that symlinks with nginx work on the mac with nginx 1.2.7.

Symlink created as:

ln -s /Users/salpher/nginxtest /usr/local/opt/nginx/html/

Do you have any content in the 'client' directory? Directory index browsing is disabled by default and you will see a 403 forbidden if there is no index page and your url does not point at a particular content file.

If it's directory browsing that you're after you can enable that in your directory config with autoindex on;

    location / {
        autoindex on;
        root   html;
        index  index.html index.htm;
    }
share|improve this answer
    
Yes, there are two files in the 'client' directory. Autoindex is turned on. I do not have an index file for the directory though or the root directive. I don't think that's creating the problem though. –  Levi Roberts Dec 6 '13 at 5:00
    
Can't seem to edit my other comment. I tried adding the root directive and an index directive, neither and both did not fix the issue. I also found that I get the same "permission denied" message when trying to point '/client' in the nginx config to the original 'client' directory. –  Levi Roberts Dec 6 '13 at 5:21
    
Do you also get a 403 when your URL points at an html file or something other than a directory? –  Sam Alpher Dec 6 '13 at 12:52
    
Yes I do. For example when trying to go to localhost/client/somefile.html –  Levi Roberts Dec 6 '13 at 13:18
    
If you haven't already you might check out serverfault.com/questions/218583/… . Sounds similar. Also, how did you install nginx? Was it a binary installation or did you grab the code and compile? If it was a binary installation where did it come from? For reference my test setup came from a brew installation. –  Sam Alpher Dec 6 '13 at 14:25
show 2 more comments

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.