Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have my web server set up running multiple sites and host them all in ~/sites/, outside apache document root (~/www), as follows:

+-~/
  +-sites/
    +-project1/
    | +-system/
    | +-application/
    | +-public_html/
    |   +-images/
    |   +-css/
    |   +-index.php
    +-project2/
    | +-system/
    | +-application/
    | +-public_html/
    |   +-images/
    |   +-css/
    |   +-index.php

I order to make sites available via the web I create a symlink in ~/www/, as below:

+-~/
  +-www/
    +-project1 -> ~/sites/project1/public_html
    +-project2 -> ~/sites/project2/public_html

With this set up I end up with domain.com/project1 and domain.com/project2 pointing to my ~/sites/projectx directories and can easily change where they point to take a site offline.

The problem I'm having is how to host domain.com outside the document root; I can't set up a symlink like the others because the symlink would have to be ~/www/ which obviously can't be used.

TLDR; I want to set up ~/sites/domain/public_html to be served when domain.com is requested.

share|improve this question
    
how to create a symlink? maybe ln /from/here/ /to/here/? –  Davuz Nov 28 '12 at 9:12
add comment

2 Answers

Create it as a virtualhost. I do this all the time. My documentroot is /var/www/HTML but I host some sites under /home/

share|improve this answer
    
I can't create a virtual host, I'm on a shared server and do not have access to httpd.conf –  Matt Sep 27 '10 at 20:23
add comment

You can use a virtualhost. Here you have an example of this:

DocumentRoot "/home/httpd/sites/site1"
ServerName   site1.com

<Directory "/home/httpd/sites/site1">
    Options -Indexes +FollowSymLinks
    AllowOverride None
    Order allow,deny
    Allow from all
</Directory>

Remember include the file in your httpd.conf

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.