pf » How do you structure your web server?
How do you structure your web server?
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 domain.com, and blog.domain.com 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/domain.com/www/web/ (this is your web server root for www.domain.com) /websites/domain.com/www/logs/ (logs go here) /websites/domain.com/www/docs/ (docs) /websites/domain.com/www/db/ (database files, optional) /websites/domain.com/www/requirements.txt
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 blog.domain.com, it would look like this:
/websites/domain.com/blog/web/ (web root for blog.domain.com) /websites/domain.com/blog/logs/ (logs go here) ...
So that's how I setup my directories, how do you do it?
/home/web/domain.com/www/public_html
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.
/home/httpd/domain.com/httpdocs/ /home/httpd/domain.com/subdomains/blog/httpdocs/ /home/httpd/domain.com/statistics/ /home/httpd/domain.com/statistics/logs/ ...
The thing I don't like is they split httpdocs and httpsdocs in the primary (*.domain.com) area and combine them in subdomains (blog.domain.com) I'd like them combined all the time.
i.e.
/websites/com.domain.www/ /websites/com.domain.blog/ ...
- Mastering CFQUERYPARAM
- Google Code Search for ColdFusion
- Speaking at CFUNITED 2008
- Getting ColdFusion SQL Statements from SQL Server Trace
- CFSCRIPT Cheatsheet
- 3 New Image Effects for ColdFusion 8
- Googlebot to Submit Web Forms
- ColdFusion 8 Update 1 Fixes some Image Processing Quirks
RSS
add to del.icio.us
Pete Freitag is a software engineer, and web developer located in











