[YLUG] symlinks

Alex Howells alex.howells at 0wn3d.us
Fri May 23 00:59:45 BST 2008


Hi Rob

> If I were to copy a directory in my /var/www folder to a new folder on
> the /home directory and then create a symbolic link from the /var/www
> folder to the new destination, can anyone see any issues with this?
> (awaits floodgates opening!)
>
> Basically my idea would be to do something along the lines of :-
>
> mkdir /home/www
> cp -pr /var/www/website /home/www/website
> ln -s /home/www/website /var/www/website
> mv /var/www/website /var/www/old_website (just in case it all goes
> wrong! I would delete this later)
>
> This approach "appears" to have worked with a silly test site and an old
> moodle site that I set up a while ago and all seems well. I just need
> convincing that Apache or MySQL isn't going to throw an obscure wobbler
> at these symbolic links. I have been very brave and moved all my current
> MySQL databases onto this drive and that has worked.

Um, I'd be tempted to not use symlinks at all actually -- keep your
relatively small /var partition to handle logs only and reconfigure
Apache and MySQL to use /home directly, for example:

    /home/auser
    /home/services/wwwroot
    /home/services/mysqlroot
    /home/theuser

For the Apache side of things you just need to change DocumentRoot and
update any <Directory> stanzas, and for the MySQL reconfiguration all
that is required is to adjust DATADIR unless I'm forgetting something
;)

Doing it via symlinks brings the possibility that extensions to PHP
such as suPHP, Suhosin and/or suExec might complain as they don't
handle symlinks particularly well ISTR... I've also seen cases where
symlinks get clobbered during a Apache/MySQL upgrade as Debian
GNU/Linux tends to assume /var/www and /var/lib/mysql are 'real'
directories. YMMV.

In short, do it properly and create a sensible directory structure
under /home then point your daemons at it.

Just my two cents,
Alex



More information about the York mailing list