ln
correctly. ln -s SOURCE TARGET
$ sudo ln -s ./sites-available/examble.domain.com ./sites-enabled
Note: The problem is not related to NGINX, NGINX compilation was just there to help me realize that the problem exists. The solution described below applies to any other related problem.
$ sudo nginx -t
nginx: [emerg] open() "/etc/nginx/sites-enabled/example.domain.com" failed (2: No such file or directory) in /etc/nginx/nginx.conf:62
nginx: configuration file /etc/nginx/nginx.conf test failed
$ file ./sites-enabled/example.domain.com
./sites-enabled/example.domain.com: broken symbolic link to ./sites-available/example.domain.com
The problem is that SOURCE
is not re-interpreted when placed to the target directory.
So, if your file that you want to link is ~/file
and you want to link it to ~/folder
using:
ln -s ./file ./folder/
Then the symbolic link will think that file
is at ~/folder/file
instead of ~/file
So, instead, you have to get into the directory ~/folder
and execute the ln
command from there.
ln
needs the relative SOURCE
directory to TARGET
directory. Not the relative SOURCE
directory to your current one.
# Getting into the folder
cd ./sites-enabled
# Creating symbolic link
ln -s ../sites-available/example.domain.com ./