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"
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.
@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
orwww-data
.We can check for the
user
directive in/etc/nginx/nginx.conf
by running:If the return of that command spits out a user, we can then change the ownership of the directories you’ve mentioned using
chown
.So if NGINX is running as
www-data
: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:
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 alwayswww-data
, so that should be the user who owns all files and directories.and then: