Apache Document Tree?

newITguy used Ask the Experts™
Hi experts:

Can anyone explain about the apache document tree for me?


Apache- cgi-bin
      - conf
      - www     -- www.primary.com -- public -- htdocs
                                   |         |
                                   |         -- cgi-bin
                                   -- private -- htdocs
                                              -- cgi-bin

                -- www.client.com -- public -- htdocs
                                  |         |
                                  |         -- cgi-bin
                                  -- [user name] --public_html

I am not quite understanding the chart above:
1) Is there folder called <primary> inside <www> and then <public><private> store in <primary>?
2) Does it all html files store in <htdocs>?
3) Why are there two folders <public> and <private>? what are they for?
4) how about the <user name> folder and <public_html>? are they belong inside the <client> folder?

Or is there any good document tree distribution?


Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
1) It depends on your configuration. Your scheme looks like you have a subdir "www" below the Apache directory. Now every domain, which is served by your apache has it's separate directory... The answer is YES.

2) YES. The "htdocs" directories are for the content you want to serve.

3) I've never seen this directory structure. The "public/htdocs" dir seems to be the main directory, which you see, if you enter only the domain name into your browser. It may be possible that your administrator has created the "private" directory as the main directory for an private subdomain (private.primary.com)... To be sure, look at your httpd.conf file usually located in /etc/httpd/.

4) I don't know. Normally the user-directories are directories called "public_html" located in the user's home directory. So every user can modify it's own files. Such directories can then be accessed via http://www.client.com/~username/. However, the administrator is able to set own user directories (other locations). Again, look at your apache's configuration file.


I still don't quite undestand. actually, that is not my configuration. i just read it from book.
what kind of files they will store in the <private> folder?

Is there any common and good file tree distribution?


I've also no idea for what the private folder is. I would say it's for an subdomain, because different subdomains need exactly the same directory structure and this dir has it's own htdocs and cgi-bin.

I'm using this structure, don't know if there are better ones.


cgi-bin - for scripts and applications
htdocs - the website itself
logs - all logs for this domain (to allow the user logfile-access, if he is in an chrooted environment)
source - files which may generate files in htdocs (xml/xsl-files for pages, or latex files which generate pdf)
data - dynamic files needed by the scripts or webpages. e.g. a php-skript, which works with data (guestbooks) needs a place to store them savely
locale - for the .po and .mo files, needed by gettext (if you host multilingual websites)

Then a configuration may look like this:

<Directory "/usr/local/httpd/domains/abc.com/www/htdocs/">
  Options +FollowSymLinks
  AllowOverride All

  ServerAdmin  webmaster@abc.com
  ServerName   www.abc.com
  ServerAlias  ww.abc.com wwww.abc.com abc.com
  DocumentRoot /usr/local/httpd/domains/abc.com/www/htdocs
  ErrorLog     /usr/local/httpd/domains/abc.com/www/logs/error.log
  TransferLog  /usr/local/httpd/domains/abc.com/www/logs/transfer.log
  AgentLog     /usr/local/httpd/domains/abc.com/www/logs/agent.log
  RefererLog   /usr/local/httpd/domains/abc.com/www/logs/referer.log
  CustomLog    /usr/local/httpd/domains/abc.com/www/logs/full.log "%v %h %l %u %t \"%r\" %>s %b \"%{Referer
}i\" \"%{User-agent}i\""

  ServerAdmin  webmaster@abc.com
  ServerName   wap.abc.com
  ServerAlias  handy.abc.com
  DocumentRoot /usr/local/httpd/domains/abc.com/wap/htdocs
and so on ....

hello experts!
i am confused that if i let tomcat capture the docroot of apache, any defination of apache will be lost...
even the cgi...


i just added a line in httpd.conf:
WebAppDeploy  ROOT warpConnection /

please help, thanks!

i am using warp as the connector between tomcat and apache

thank you !

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial