简体   繁体   中英

Permission denied with nginx and php

  • I have create under my nginx webdir a ln -s (symbolic link) to a directory in my homedir
  • I now try to read it from a PHP script but get:

Warning: opendir(/usr/local/n/test): failed to open dir: Permission denied in /usr/local/n

  • I have set no open base dir in php.ini
  • directory and files are having a group in which the web user is part of
  • both nginx and php fpm run under that same user

How can I fix this?

The only solution to this was to copy the files. I wasn't able to get nginx to read symbolically linked files.

I've seen recommendations that the files under the main 'public' or 'html' directory can be followed, but this was not the case for me.

I remember there is option in php or nginx(apache) to allow symbolic link, you need to check that. you could search google : nginx and php using symbolic link I couldn't remember that option exactly.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM