Apache Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsSystem AdministrationApache Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old November 22nd, 2001, 01:40 PM
zpepperfly zpepperfly is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2001
Posts: 4 zpepperfly User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Directory hierarchy and layout preferences

I am working on a new web site for the computer science department for Memorial University of Newfoundland(both front-end and back-end). I am spending a lot of time on pre-implementation design. There is one thing I would like advice on before I proceed. It is actually more of a cosmetic problem but I was wondering about directory naming, hierarchy and placement and of vritual hosts, cgi-bins, servlet bins, etc... I am aware that most of this has to do with personnal preference, but I still believe that people who are professional(or well experienced) choose such hierarchies based on logic and know idioms. My problem is I have never undertaken such a project. I was wondering if anybody can give advice on how I should structure my site, or on how they usually structure theirs(include logic for naming, hierarchy, and placement). Because this is usually preference I have found it hard to find guidance on such issues. (If this shouldn't be in the apache forum sorry, I believe that such hierarchy has alot to do with apache setup.)

I will now describe the site and the present solution:
1)The main url is URL
2) We also have about 5 other virtual hosts, we host for people(or groups) associated with the department. ex. URL
3) Those virtual hosts are basically symlink redirections to user directories. ex. ~slug/index.html
4) Right now the directory hierarchy is:
/web-> /htdocs -> /images (stores site images)
----------------------> /people (an example of a sub directory with static html content - we have maye 10 of these)
----------------------> /slug (symlink, to ~slug, which is used in the virtual host document root directive - we have several of these)
----------------------> index.html ( static files)

/web-> /cgi-bin (where all the cgi programs reside)
/web-> /icons (icons used by apache)

Below is some of the configuration from the httpd.conf:

##################################
ServerName URL

DocumentRoot "/local/web/htdocs"

# This should be changed to whatever you set DocumentRoot to.
<Directory "/local/web/htdocs">
Options Indexes Includes FollowSymLinks
AllowOverride None
AuthConfig FileInfo Limit
Order allow,deny
Allow from all
</Directory>

ScriptAlias /cgi-bin/ "/local/web/cgi-bin/"
<Directory "/local/web/cgi-bin">
AllowOverride None
Options ExecCGI Indexes FollowSymLinks Includes
Order allow,deny
Allow from all
</Directory>

### Section 3: Virtual Hosts
NameVirtualHost 134.153.1.5

<VirtualHost 134.153.1.5>
ServerName URL
ServerAlias www stretch stretch.cs.mun.ca
DocumentRoot /local/web/htdocs
</VirtualHost>

<VirtualHost 134.153.1.5>
ServerName URL
ServerAdmin URL
DocumentRoot /local/web/htdocs/slug
</VirtualHost>
# more virtual hosts below this
################################

What I wanted to do was break up logically the vritual hosts from the main site. Actually I wanted to make the main site URL behave more look more like a virtual host. Right now it has a small virtual host entry, however, the main server configuration(default for all virtual hosts) is pretty much configured for it. So instead of having a main htdocs site for the URL I thought I would make separte directories, such as /web/www.cs.mun.ca/ and /web/www.slug.nf.net/ etc...(for other virtual hosts). If I did break it up like this would it be better to have them under say /web/htdocs ex. /web/htdocs/cs and /web/htdocs/slug, etc... And in such a case would it better to name them short names like '"cs" and "slug" as opposed to "www.cs.mun.ca" and "www.slug.nf.net"? Also, the virtual hosts docs on apache suggests that if virtual hosts are used the "main server" configuration should be general and minimal(which is not our current setup), but how general and minimal should it be? i.e Should there still be a DocumentRoot directive for the main server? Should there be a ScriptAlias directive?

The last question above also presents me with a new delema. Should I have the cgi-bin directory inside(below) the DocumentRoot in each VirtualHost or should it have a ScirptAlias instead.

# example 1 note:not complete but can the jest of it
<VirtualHost 153.1.59>
SeverName URL
DocumentRoot "/web/slug/htdocs/"
ScriptAlias cgi-bin "/web/slug/cgi-bin"
</VirtualHost>

#example 2
<VirtualHost 153.1.59>
ServerName URL
DocumentRoot "/web/slug/"

<Directory "/web/slug/cgi-bin">
Options +ExecCGI
</Directory>
</VirtualHost>


I guess the major difference between the two is that the first one must be accessed by its url such as <a href="www.slug.nf.net/cgi-bin/putpage.pl">, and the second one can be accessed can be accessed absolutely by a document being served i.e <a href="../cgi-bin/putpage.pl">. The second is the one I would choose, however, I've noticed that the first is usually used. Why? An aside from this, should page writers use absolute paths such as "../../cgi-bin/" or "www.slug.nf.net/cgi-bin" ?

Finally, I have tomcat installed on my machine and wondered if there is a common idiom used for storing servlets, such as /cgi-bin is for cgi programs. For example would /web/slug/serlets/ be a good idea? Or should I nest it under /cgi-bin like some peolpe have suggested to me. i.e /web/slug/cgi-bin/servlets/ (I personally don't like that one.)

Sorry about the length of this, however, I would appreciate any advice. Anything disucussion would be nice, such as your own solutions, and also naming standards(i.e img/ vs. images/ or styles/ vs. css ,etc...)

Thank-you

Reply With Quote
  #2  
Old November 22nd, 2001, 05:34 PM
freebsd freebsd is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2001
Posts: 5 freebsd User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Check out this thread -> http://forums.devshed.com/showthrea...5416&forumid=31

or do a search under my username with the keyword like: suexec. I know you haven't mentioned suexec but the directory layout is the same and can apply to you.

I didn't read thru your message but I have found several configure errors.

>> ScriptAlias /cgi-bin/ "/local/web/cgi-bin/"
>> <Directory "/local/web/cgi-bin">
>> AllowOverride None
>> Options ExecCGI Indexes FollowSymLinks Includes

A ScriptAlias'ed cgi-bin can't have any Options nor can it be overridden. So set Options to None and AllowOverride to None.

>> ServerName www.cs.mun.ca
>> ServerAlias www stretch stretch.cs.mun.ca

THe ServerAlias should be: stretch.cs.mun.ca and that's it.

>> DocumentRoot "/web/slug/htdocs/"
>> ScriptAlias cgi-bin "/web/slug/cgi-bin"

Should be written as:

DocumentRoot "/web/slug/htdocs"
ScriptAlias /cgi-bin/ "/web/slug/cgi-bin/"

>> <Directory "/web/slug/cgi-bin">
>> Options +ExecCGI

As mentioned above, Options should be None.

Reply With Quote
Reply

Viewing: Dev Shed ForumsSystem AdministrationApache Development > Directory hierarchy and layout preferences


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway