Create Symlink

Posted on the 22 April 2014 by Akahgy

Description:

A symlink (or symbolik) link allows creating an alias for a file or folder in a different folder with a different name. This can come in handy for accessing special folders in the structure that don’t need to be made public, or creating special rules or exception in server access.

Solution:

A symlink is created easy with the following command:

$ ln -s {/path/to/file-or-folder} {symlink-alias}

For example:

$ ln -s /htdocs/myproject/important_folder /htdocs/mylink

Then we can set up for example a location block in our nginx configuration, that points to that folder:

location /visible_link/ {
root /htdocs/mylink;
}