3

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"
2
  • whats in your error_log? Jun 17, 2013 at 11:16
  • I have updated my question
    – ceth
    Jun 17, 2013 at 11:42

3 Answers 3

2

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!)

2

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/.

0

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

1
  • 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.
    – ceth
    Jun 17, 2013 at 10:59

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .