| do my sites have to be under the DocumentRoot?
|
httpwebwitch

msg:4250884 | 3:11 am on Jan 9, 2011 (gmt 0) | As I set up my new server, I've created a user home directory: /home/me/sites/ under that I've created folders for each of my sites: /home/me/sites/domain1.com /home/me/sites/domain2.com /home/me/sites/domain3.com /home/me/sites/domain4.com and in each of those, a public_html folder to hold their stuff: /home/me/sites/domain4.com/public_html And in there, I've put a little index.php action. Now, I've created my first VirtualHost entry: NameVirtualHost * <VirtualHost *> ServerAdmin webmaster@domain1.com DocumentRoot /home/me/sites/domain1.com/public_html ServerAlias domain1.com *.domain1.com </VirtualHost> |
| The DNS for the domain is already set up properly now when I point a browser at domain1.com, I see this: Forbidden You don't have permission to access / on this server. |
| instead, if I change my VirtualHost to point to this: | DocumentRoot /var/www/html/ |
| then I see the PHP page I dropped there while I was setting up Apache. So my question is: do my Virtual Host sites all need to be in a directory beneath the DocumentRoot specified in httpd.conf? (/var/www/html/) If so, then I have a lot of reorganizing to do :( I thought I was being smart by putting my sites into distinct folders. On my previous host (using add-on domains in CPANEL) I was often annoyed that my sites were often accessible via subfolders and subdomains of the root domain, like http://mypersonaldomain.com/anothersite/index.php and http://anothersite.mypersonaldomain.com/index.php and I had to do some tedious shenanigans with .htaccess to prevent that most of the other servers I've ever dealt with had that same configuration. Maybe I'm wrong for trying to reinvent the wheel?
|
encyclo

msg:4250886 | 3:28 am on Jan 9, 2011 (gmt 0) | There's nothing wrong with your setup, just that you have probably not altered your httpd.conf to give Apache access to /home. From memory (can't easily check the specifics at the time of posting), you will have have an entry for <Directory /> which will have a "Deny from all", then another for <Directory "/var/www/htdocs"> which will open things up a bit just for access to files within the specified document root. You just need to add a similar entry for your paths. Alternatively you can separate out sites with one Unix login per site and use UserDir public_html (old-skool shared hosting style), then set the Virtual Hosts accordingly: /home/siteone/public_html /home/sitetwo/public_html cPanel is evil. I hate nesting document roots, even for subdomains - there's no reason to do so.
|
httpwebwitch

msg:4250892 | 4:10 am on Jan 9, 2011 (gmt 0) | wicked. I'll pick through the conf looking for that
|
|
|