Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have just started a server with debian,

I'm new to this sort of thing so please bare with me.

What I'm trying to achieve is this:

Request comes in :

I have to DocumentRoot setup as /var/www/common

I make a symbolic link in /var/www/common like "ln -s /home/user/folder/"

How do i get apache to recognize that as a user directory and follow it.


share|improve this question

migrated from May 4 '13 at 1:11

This question came from our site for professional and enthusiast programmers.

up vote 1 down vote accepted

I'm not sure if this is exactly what you need but should be enough to start. First of all, www-data user (debian's default for apache) have to have access to /home/user/folder

You can then create new configuration for apache in file /etc/apache/sites-available/virtuals

<VirtualHost *:80>
    DocumentRoot /var/www/common/default/
    VirtualDocumentRoot /var/www/common/%0

    <Directory />
            Options FollowSymlinks
            AllowOverride All

Then you need to activate this config with

a2ensite virtuals
service apache2 reload

It is probably better to disable default configuration with

a2dissite default
service apache2 reload

In /var/www/common/default should be some default page when non-existent page is requested.

With this config you can simply create directory for any domain you wish to handle on server /var/www/common so will be provided from /var/www/common/ directory

Also more secure is to set SymLinksIfOwnerMatch instead of FollowSymlinks, see appropriate documentation.

share|improve this answer
Hi thanks for this reply, although i get the error - Invalid command 'VirtualDocumentRoot', perhaps misspelled or defined by a module not included in the server configuration – Matt256 May 8 '13 at 18:05
Ah i solved that issue, now it works. Thanks – Matt256 May 8 '13 at 18:16

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .