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.

I have Nginx installed on Ubuntu and I have the next configuration file:

server {
    root /www/test;
    index index.html index.htm;

    server_name .dev.mysite.info;

I have HTML files in the directory /www/test and all works fine.

Now I want to change my folder to soft link:

lrwxrwxrwx  1 root root   33 Jun 17 10:39 test -> /root/Dropbox/digital_ocean/test/

But get the error message inthe browser:

"500 Internal Server Error"

Why and how can I fix it ?

Update:

root@ocean:/var/log/nginx# cat error.log 
2013/06/17 11:40:27 [crit] 26197#0: *1 stat() "/www/test/" failed (13: Permission denied), client: 195.239.188.28, server: dev.meditat0r.info, request: "GET / HTTP/1.1", host: "meditat0r.info"
2013/06/17 11:40:27 [crit] 26197#0: *1 stat() "/www/test/" failed (13: Permission denied), client: 195.239.188.28, server: dev.meditat0r.info, request: "GET / HTTP/1.1", host: "meditat0r.info"
2013/06/17 11:40:27 [crit] 26197#0: *1 stat() "/www/test/index.html" failed (13: Permission denied), client: 195.239.188.28, server: dev.meditat0r.info, request: "GET / HTTP/1.1", host: "meditat0r.info"
2013/06/17 11:40:27 [crit] 26197#0: *1 stat() "/www/test/index.html" failed (13: Permission denied), client: 195.239.188.28, server: dev.meditat0r.info, request: "GET / HTTP/1.1", host: "meditat0r.info"
...
2013/06/17 11:40:27 [error] 26197#0: *1 rewrite or internal redirection cycle while internally redirecting to "/index.html", client: 195.239.188.28, server: dev.meditat0r.info, request: "GET / HTTP/1.1", host: "meditat0r.info"
share|improve this question
    
whats in your error_log? –  Andrei Mikhaltsov Jun 17 '13 at 11:16
    
I have updated my question –  demas Jun 17 '13 at 11:42

3 Answers 3

up vote 2 down vote accepted

Basic default permission for root folder is rwx----- so noone except root can read/write from it. You may:

a) Move your dropbox folder to other location (preferrable way: create separate non-root user)

b) change permissions to /root folder (never do that!)

share|improve this answer

The problem is how symlinks work. A symlink is basically a signpost saying "the content you're looking for is not here, you have to go look in /root/Dropbox/digital_ocean/test/ instead". And that means that the directory /root/Dropbox/digital_ocean/test/ must be a) accessible with the same filesystem rights as the web directory, and b) that the webserver needs to be configured to allow access to that directory. I'm not an nginx expert, but I believe you will need a Location directive for /root/Dropbox/digital_ocean/test/.

share|improve this answer

Check your config files, the following option may be relevant.

diable_symlinks

http://nginx.org/en/docs/http/ngx_http_core_module.html#disable_symlinks

share|improve this answer
    
I have 'grep'-ed my config files and have not found this directive. a have added 'disable_symlinks off;' to my nginx.cong and restarted Nginx, but it did not help. –  demas Jun 17 '13 at 10:59

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.