Linux Symbolic Linking not working as expected
Solution 1:
So what you have there is a symbolic link that links back to itself. I don't see how that's possible with the command you listed at the top of your question, so I suspect this particular symbolic link was created differently.
I can replicate your scenario like this:
sazerac:~ insyte$ cd testlinks/
sazerac:~/testlinks insyte$ ls
sazerac:~/testlinks insyte$ ln -s www www
sazerac:~/testlinks insyte$ ls -l
total 8
lrwxr-xr-x 1 insyte staff 3 Mar 5 10:33 www -> www
Let's try an experiment. Execute the following commands exactly as listed:
echo "hello insyte" > /etc/nginx/sites-available/insyte
ln -s /etc/nginx/sites-available/insyte /etc/nginx/sites-enabled
ls -l /etc/nginx/sites-enabled|grep insyte
cat /etc/nginx/sites-enabled/insyte
Solution 2:
You've somehow managed to create a symbolic link that links to itself. I didn't even know you could do that, but I'm quite sure it won't have the result you want.
To fix it, remove the symlink and recreate it correctly.
rm -f /etc/nginx/sites-enabled/www
Or just use the -f
option to ln
and it may remove the invalid symlink for you.
ln -fs /etc/nginx/sites-available/www /etc/nginx/sites-enabled/www