nginx doesn't follow symlinks with www-data user
Asked Answered
T

1

5

I have created a folder to the default server at /var/www/default and everything works as expected. Inside that folder I made a symlink to ~/WebstormProjects/my-project, using the common ln -s. It worked for a while, and the last time I updated using apt-get, nginx doesn't follow anymore the symbolic link, which gives me a 404 error, not even listing the symlinks as it used to do.

Tried using the disable_symlinks directive, setting it to off, and nothing happened. Also followed the steps in this link and still nothing. Also added myself to the www-data user, nothing.

But if I edit nginx.conf by changing the user directive to my own user and restarting the server does work, but I know that's a very bad practice and some day in the future it will not allow PHP-FPM to work.

So, what can I do to make nginx follow symlinks, without changing the owner of my source directories? BTW, I'm using Ubuntu 14.04.3 and nginx 1.4.6 installed via package manager.

Tutelary answered 30/10, 2015 at 2:51 Comment(2)
disable_symlink has if_not_owner optionMacedoine
By setting it, I will enable disabling symlinks, which is not the behavior I want.Tutelary
T
8

It was just a problem with permissions:

chmod 755 /home
chmod 755 /home/user

Got previous commands from this answer.

Tutelary answered 5/5, 2016 at 23:2 Comment(1)
Thank you so much! so I had to open read permission of parent directories!Detradetract

© 2022 - 2024 — McMap. All rights reserved.