Apache httpd.conf file update

marc

New member
Joined
May 6, 2004
Messages
3
In directadmin when you add a new subdomain it sets the DocumentRoot as something like:
/home/user1/domains/domain.com/public_html/subdomain/


Well I've been going in and editing it by hand setting some of the DocumentRoots to:
/home/user2/public_html/

I do this because I just like to have the subdomains not accessable by www.domain.com/subdomain/ and I like to only give a person access to their home directory that was created.

So what i'm wondering is, how can I stop directadmin from changing the documentroot every time it updates the httpd.conf. I have to always go back in and fix each DocumentRoot when I add a new subdomain. It's getting a bit annoying.

Thanks
 
Hello,

You bet :)

cd /usr/local/directadmin/data/templates
cp virtual_host*sub.conf custom
cd custom

edit the 2 files.

change the document root to:
Code:
DocumentRoot |DOCROOT|
from
Code:
DocumentRoot |DOCROOT|/|SUB|
Then just run:

echo "action=rewrite&value=all" >> /usr/local/directadmin/data/task.queue

:)

John
 
By doing that it just points all subdomains to the public_html directory.

I might of not been clear but I was wondering how you can set the document root on each subdomain/domain seperatly without having to edit the httpd.conf. Some subdomains I like it at the default and some I like to point to it's own /home/sub directory.

I'm sorry if I'm being confusing.

Like is there an option in directadmin that you can say "point this subdomain at this folder." So everytime it updates, it will set the DocumentRoot to that and not the default.

example:
subdomain1 - > /home/user1/public_html
subdomain2 - > /home/admin/domains/domain.com/public_html/subdomain1
 
Last edited:
Marc,

There is a command in Linux called "chattr". If you do "chattr +i" it makes a file "immutable" meaning root cannot even edit it without reversing those attributes (chattr –i).
The FreeBSD version of that command? It's "chflags"; equivalent of "chattr +i" would be "chflags schg", and the “un” doing if the command would be "chflags unschg".

HTH,

Mike
 
Thanks but that won't work either. Wha happens when i want to add a new subdomian/domain i'm going to have to reopen that file and it's going to update it with the defaults and i'm still going to have to change it by hand.

Oh well.

Thanks anyway.
 
Back
Top