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.
Create it as a virtualhost. I do this all the time. My documentroot is /var/www/HTML but I host some sites under /home/
You can use a virtualhost. Here you have an example of this:
Remember include the file in your httpd.conf