document root per dir Apache 2.0

This is a discussion on document root per dir Apache 2.0 within the Linux Web Servers forums, part of the Web Server and Related Forums category; Jorey Bump wrote: > No wonder you're confused. May I suggest a different layout: > > /var/www/sites/...


Go Back   Usenet Forums > Web Server and Related Forums > Linux Web Servers

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #11 (permalink)  
Old 08-17-2005
Jonathan N. Little
 
Posts: n/a
Default Re: document root per dir Apache 2.0

Jorey Bump wrote:

> No wonder you're confused. May I suggest a different layout:
>
> /var/www/sites/mother.lws.lan
> /var/www/sites/www.cadopugs.com
> /var/www/sites/www.bigbra.com
>
> Having sites within sites is chaos. You can stop using the /var/www/html
> directory entirely (unless you need it for suexec). This layout is a lot
> more flexible, especially if you ever use mass virtual hosting.
>

Whew! I thought I was just slow! Seriously, I am an artist, but as a
Renaissance man my knowledge is wide but not as deep as I like! But here
is central VA when I say Linux or Apache I receive a long blank stare!
;-) I am self-taught. So if you indulge me I have a few more questions

Ok, 'mother' is my Apache 2.0 server, I have another 'Bob' that runs
Apache 1.3. The only thing I use mother's web site for is the Apache
document ion on the default document root /var/www/html/ so I'd like to
keep it, but like your suggestion to move clients off the main server's
document root

/var/www/sites/cadopug
/var/www/sites/bigbra
....

The way I have things on my LAN setup private or experimental sites are
under my private LAN domain 'lws.lan'. I don't publicly host, inside my
router client sites for which they have actual public FQD I have the
local 'Dev|Maintenance' copies as w3.cadopug.com and my LAN's DNS is
authoritative. The public versions www.cadopugs.com are forwardered out
handled by public DNS and respective hosting servers.

> Also, don't use these as the document root, each should have a
> subdirectory (such as website/) to serve that purpose, and even a
> separate cgi-bin directory, if needed (parallel to website/, not in it).
> This allows you to put support files outside of the DocumentRoot, where
> they can't be accessed directly by a browser.


I agree but the the cgi-bin is best out of the document root, but the
hosting companies that I am dealing with have it within. I am trying to
mirror what they do so that a site that I test on my private LAN as
w3.someclient.com will work like the public www.someclient.com! I like
to get the bugs out before I go public! At least I try ;-)

>>respectively. So I guess what I want to do is for the server's default
>>'mother.lws.lan' server definition add the rewrite
>>
>>RewriteEngine On
>>RewriteRule ^/([^/]+)/(.*)$ /var/www/html/sites/%1/%2 [P]
>> /or/
>>RewriteRule ^/([^/]+)/(.*)$ /sites/%1/%2 [P]
>>
>>I did something wrong because I get a Forbidden error, with
>>http://mother.lws.lan/cadopugs/index.html
>>
>>but before the rewrite rule it was accessable as
>>http://mother.lws.lan/sites/cadopugs/index.html. Also if a correct
>>whatever error that I am making in my regexp would this actually mean
>>the DOCUMENT_ROOT would become '/var/www/html/sites/cadopugs' for
>>http://mother.lws.lan/cadopugs/...
>>and '/var/www/html/sites/bigbra' for http://mother.lws.lan/bigbra/...
>>and not mother.lws.lan's '/var/www/html' ?

>


Now if my client sites are moved out side of the main server's document
root, i.e.,

/var/www/sites/ not under /var/www/html/...

and I am trying to mimic the SSL certificate sharing like the hosting
companies, I use the dummy one I setup for mother. Originally I had
these sites under mother's document root so the
41_mod_ssl.default-vhost.conf the default <VirtualHost _default_:443>
section handled it.

<embarrassment>I kludge some <Directory> sections to allow the virtual
host's cgi-bin to work... </embarrassment>

How would I define the client sites in
41_mod_ssl.default-vhost.conf
so that they would they would be accessed via
https://mother.lws.lan/cadopugs now they are not under mother's default
SSL definition, but I am sharing the dummy SSL certificate?
Also I have to get their respective cgi-bin directories to work since
some have shopping cart scripts!

> No, you're missing the point here. In order to use a proxy rewrite, you
> must use an URL as the target, not a file location:
>
> RewriteEngine On
> RewriteRule ^/cadopugs/(.*)$ http://www.cadopugs.com/$1 [P]
> RewriteRule ^/bigbra/(.*)$ http://www.bigbra.com/$1 [P]
>
> If you only have a few sites, start with this, rather than trying to
> devise a generic regex that is too complex for your needs.
>


Would I use some rule like:

RewriteRule ^/cadopugs/(.*)$ https://mother.lws.lan/$1 [P] in the
_default_443 section and change _default_443 document root to
'/var/www/sites' ?


Sorry to ask so many questions, I am reluctant to do too many major
changes at this moment (without full understanding) because I have my
own business website mirrored on this server and I have to keep it
synced with my online one for my business sales....

I guess I could fool with 'Bob', the Apache1.3 server the config should
be fairly similar, just appears that 2.0 splits the conf into several
sub-conf files....

Again, thank you for all your help!

--
Take care,

Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 09:04 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0