Question

error 404 Not Found to symlink

created a symlink like this

from Hdd To SSD

ln -s /run/media/alireza/hdd/public_html/ .

error log :

2017/01/20 05:29:22 [crit] 19206#0: *1 stat() "/home/alireza/public_html/" failed (13: Permission denied), client: 127.0.0.1, server: abc.dev, request: "GET / HTTP/1.1", host: "abc.dev"

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

@vistacali

The user that NGINX is running as must be able to access the directories its attempting to read and/or write to. In most cases, NGINX is either running as the user nginx or www-data.

We can check for the user directive in /etc/nginx/nginx.conf by running:

grep user /etc/nginx/nginx.conf

If the return of that command spits out a user, we can then change the ownership of the directories you’ve mentioned using chown.

chown -R user:group /insert/path/here

So if NGINX is running as www-data:

chown -R www-data:www-data /insert/path/here

If the grep command doesn’t spit out a user, we can always see who owns NGINX’s directories and we should be able to use that user.

Simply run:

ls -al /etc/nginx

and grab the user from the output.

As a side note, things are a bit different if you happen to be running PHP-FPM with NGINX. In that case, the directories and files should be owned by the user that the PHP-FPM process is running as.

If you are running PHP-FPM, you can cd in to the main directory and check the pool file. If you’ve not modified anything there for your setup, the default user for PHP-FPM is always www-data, so that should be the user who owns all files and directories.

cd /etc/php/*/fpm/pool.d/

and then:

nano www.conf