Pete Freitag Pete Freitag

How do you structure your web server?

Updated on December 06, 2023
By Pete Freitag

MossyBlog is asking about how people setup their new web servers. I though I'd post my thoughts on directory structure here.

This is web server directory structure that I have used for long time (probably 6 or 7 years). A former co-worker Eric Griff helped me come up with it I believe.

We wanted a directory structure that would allow us to keep domains grouped together, so if you have, and the will be located near each other. Also we wanted there to be room to put things related to the domain above the web root such as logs, documentation, and at the time we used access, so we also had a directory for the database files. I haven't used access in years so I leave that one out now.

So here's what it looks like:

/websites/ (this is your web server root for
/websites/ (logs go here)
/websites/ (docs)
/websites/ (database files, optional)

The requirements.txt is a file where you can put any server requirements that the site has, I usually list what datasources, custom tags, or server components the site requires in this file. Then if I want to move it to another server you know what you need to install to get the site working.

Now when you setup another site under that domain, such as, it would look like this:

/websites/ (web root for
/websites/ (logs go here)

So that's how I setup my directories, how do you do it?

web server directory architecture

How do you structure your web server? was first published on July 26, 2005.

Discuss / Follow me on Twitter ↯


Looks fairly similar to what I use as well. I have a bad habit of putting it in the /home/ directory though which I should probably change.. ie:


All of the FreeBSD ports install things underneath /usr/local/www and I just create links to those directories if I'm using something from the ports system.
by Brandon Harper on 07/26/2005 at 2:15:36 PM UTC
I have the files in /var/www/domain/public_html, but all the logs go to /var/log/httpd for easy awstats processing, rotating and achiving.
by Neculai Macarie on 07/26/2005 at 4:45:09 PM UTC
What about using the reverse of the web address as the directory name? Similar to Java package names.


by Abhijit on 07/27/2005 at 10:56:51 PM UTC
Help! Amatuer here : ) I have a website I created w/ FrontPage 2002. I need to remove images from google. I followed the protocol I found on the web. My question is> It says I have to create a robots.txt file in the "web server root". - I did create a 'new page' as a robots.txt file. - When they say "web server root" could some explain exactly what that means & how I get there? - I learned alot on my own - but don't know all the 'language' yet. Appreciate any help : )
Thank you!
Rose [email protected]
by Anonymous on 08/09/2005 at 10:27:54 PM UTC
What is rotating domains?
by Dot Bambach on 07/12/2006 at 7:00:43 PM UTC