I have installed nginx on Ubuntu 12.04. However, nginx does not seem to follow symlinks. I understand that there is a config change required for this but I am not able to find where to make the change. Any help appreciated.
相关问题
- How can I prevent my Shiny App from disconnecting
- Can't configure nginx as a proxy for tomcat wi
- softlinks atime and mtime modification
- How to set Nginx URI to fix empty URI in redirect
- why does connect domain to “Shopify” ask for eithe
Have a look at the following config option from nginx docs:
if olibre's answer doesn't help edit the file /etc/nginx/sites-available/default and add this line where you've specified your server root directory.
save the file and restart server
In my case
nginx
was already configured to follow symbolic links. But the issue was the usernginx
could not access my home files and therefore symbolic link to my home directory was not working.Example
Suppose we have symbolic link
/usr/share/nginx/www/mylink
->/home/u/html
Give permissions
Give the read and execute permissions using
chmod
andfind
:Notes:
The permission
x
is named execute. But when applied to a directory, this permission allows to recurse the directory tree (see Unix modes).The command
find ... -exec chmod ...
recursively changes the permissions. We could also use the commandchmod -R +rx /home/myuser/html
but this last command also gives the execution permission to all regular files, and we do not want that. The option-type d
executechmod
to only directories.The last optional command gives write permission if your PHP scripts require to write data. Try to limit write permission to only required directories for security reasons.
Test
No need to restart
ngnix
, just press Ctrl+F5 in your browser.Caution: It is not recommended to create symbolic links pointing to your home directory because a mistake on read/write access or a wrong symbolic link may expose your digital data...
Reference: Arch wiki on nginx