LINUX.IE, website of the Irish Linux Users' Group
Tux rules!

   
Home
New Users
Articles
Download
Projects
Community
Vendors

  Print Version
Email to...
 
Archives:


planetILUG

Recent News

News Archive


Join the
ILUG
on FaceBook


Join the
ILUG
on LinkedIn


Join the
ILUG SETI
Group



















 
 :: Mailing Lists

[Webdev] apache directory structure

[Webdev] apache directory structure

Adam Beecher adam at iewebs.com
Fri Sep 22 11:31:06 IST 2000


> Hi all, thanks for all the help with the installation.
> I have one more question. I am confused as to what the
> best directory structure is for virtual hosts.
> Does it matter ? ie. once i create a structure and
> stick to it?
>
> Is there anything wrong with creating this stucture?
> /home/html/virtualhost1
> /home/html/virtualhost2
> /home/html/virtualhost3
> etc , because this is what i am planning on using.
>
*Kind of* If /home/html is the DocumentRoot for the main server, it's bad,
because people would be able to visit sites @
http://www.themaindomain.com/virtualhost1/. That's not very secure.

> What is the norm ? Thanks in advance
>
There's no real norm. It depends on how many virtual hosts you're going to add
to the server, what users are going to have access, etc. For example, if you're
going to be selling hosting, you're going to need to chroot your users. If
you're going to have lots of users, you need to come up with a structure. If
you're going to have lots of users with multiple sites, you'll need a more
complex structure.

Whatever you're doing though, you should think it out very carefully before you
begin - making changes across the board later on can be a pain in the arse. On
my slightly older machine in the US, I used to have a structure under
/home/httpd, but the clients have been adding up, and the paths in my PHP
scripts have been getting longer, so I'm moving them to a root /www directory.
But they have to be moved one at a time, slowly and carefully, so there can be
no screwups. It's a pain in the behind... :)

Here's the new structure under /www:

/www/iewebs			# ieWebs sites
/www/internal			# Other sites that we run
/www/clients			# Clients
/www/clients/serv		# Hosting clients
/www/clients/serv/client1		# Client1's Home directory
/www/clients/serv/client1/site1	# DocumentRoot for Client1/Site1
/www/clients/serv/client1/site2	# DocumentRoot for Client1/Site2
/www/clients/serv/client2		# Client2's Home directory
/www/clients/serv/client2/site1	# DocumentRoot for Client2/Site1
/www/clients/serv/client2/site2	# DocumentRoot for Client2/Site2
/www/clients/dev		# Much the same as above

However, we also have a RaQ in the UK now, which we're using solely for hosting
clients, and that has a completely different structure (which you're tied to,
because that's the way the RaQ works:

/home
/home/sites				# All the sites go under here
/home/sites/eu.iewebs.com		# symlink to /home/sites/site1
/home/sites/site1			# Main directory for site1
/home/sites/site1/certs			# SSL cert for site1
/home/sites/site1/web			# DocumentRoot for site1
/home/sites/site1/users			# Main users directory for site1
/home/sites/site1/users/user1		# Home directory for site1/user1
/home/sites/site1/users/user1/web	# DocumentRoot for site1/user1

That's just a very basic representation. Site administrators are chrooted into
the root directory for a site, and regular users are chrooted into their own
home directories. Each site gets a separate group too, so there can be no
tinkering between sites.

So basically, you need to think this out carefully before you start, and figure
out where you're going with the machine. If you're going to be arsing around
with it, and you'll only have trusted users, you can pretty much do what you
want. If you need to be organised from the start though, you need to come up
with a good heirarchy, and you should look into things like default permissions,
users and groups, chroot and quotas now, because it will eventually catch up
with you.

HTH,
adam





More information about the Webdev mailing list
Read this without the formatting.
                                                                                                    

 

Hosted by HEAnet


Maintained by the ILUG website team. The aim of Linux.ie is to support and help commercial and private users of Linux in Ireland. You can display ILUG news in your own webpages, read backend information to find out how. Networking services kindly provided by HEAnet, server kindly donated by Dell. Linux is a trademark of Linus Torvalds, used with permission. No penguins were harmed in the production or maintenance of this highly praised website. Looking for the Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!
RSS Version
Powered by Dell