Search code examples
nginxpermissionsubuntu-14.04configuration-filessymlink

nginx doesn't follow symlinks with www-data user


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.


Solution

  • It was just a problem with permissions:

    chmod 755 /home
    chmod 755 /home/user
    

    Got previous commands from this answer.