I'm trying to consolidate some website files on one of our CenotOS servers, the setup i want to create is something like this but i'm not sure if its actually possible
we would have a set of files used by all sites:
/home/commonfiles/
public_html/
library/
each site directory would look something like this:
/home/site1/bespoke/
css/
images/
each "site" would use the public_html
and library
folders from within the common files. Symlinks would obviously work for this. What i would also want though is for /home/commonfiles/public_html/css
to point to /home/site1/bespoke/css
where site1
is the site that the absolute link to /home/commonfiles/public_html/
is from. I know its possible to create relative symlinks but is it possible for an absolute symlink to contain a relative one.
I hope this makes sense as i'd really appreciate some advice
EDIT
to elaborate, this is the basic structure i would want (if its possible)
/home/common
/home/common/public
/home/common/library
/home/site1
/home/site1/public -> /home/common/public
/home/site1/library -> /home/common/library
/home/site1/bespoke/
/home/site1/bespoke/css
/home/site1/bespoke/images
/home/site1/public/css -> /home/site1/bespoke/css
/home/site1/public/images -> /home/site1/bespoke/images
/home/site2
/home/site2/public -> /home/common/public
/home/site2/library -> /home/common/library
/home/site2/bespoke/
/home/site2/bespoke/css
/home/site2/bespoke/images
/home/site2/public/css -> /home/site2/bespoke/css
/home/site2/public/images -> /home/site2/bespoke/images
I guess essentially the mapping of - for example - /home/site1/public/css -> /home/site1/bespoke/css
does not necessarily have to be done with links, maybe this could be done in the .htaccess in some way. Hopefully you can see what i'm trying to achieve here though.
just to add to this, this is essentially what i'd like to be able to do (if it worked):
mkdir test
mkdir test/common
mkdir test/common/public
mkdir test/common/library
mkdir test/site1
mkdir test/site2
mkdir test/site1/bespoke
mkdir test/site2/bespoke
mkdir test/site1/bespoke/css
mkdir test/site1/bespoke/images
mkdir test/site2/bespoke/css
mkdir test/site2/bespoke/images
ln -s /home/user/test/common/public test/site1/public
ln -s /home/user/test/common/library test/site1/library
ln -s /home/user/test/common/public test/site2/public
ln -s /home/user/test/common/library test/site2/library
cd test/common/public
ln -s ../bespoke/css css
ln -s ../bespoke/images images
It's not possible with links
The answer is yes. The test below is probably too tangled for what you want to do, but it may help illustrate what can be done.
That last entry is kind of interesting. It's essentially
/absolute/path/to/test/a/../a/dir1
.I do this with the multiple Wordpress installs on one of my web servers.
I setup the 'wp-content' directory (which has themes and plugins) to be shared amongst installs thusly:
This would be done:
I have perms on my
/home/common/wp-content
directory set torwxrwxrwx
on this particular device.