command line config changes & DA

JonR

New member
Joined
Sep 21, 2005
Messages
1
Hey peeps,

we're thinking of buying DA, but need to one important thing.
If we make changes to config files, or virtualhosts or suchlike via the command line, will the control panel pick up these changes? or will it bomb out and put the files back to what the CP last saw them as.

Reason i ask, is a lot of stuff we do will be done via the command line, but some stuff will be done via the CP (by the users)

Other CPs such a h-sphere will jst reset changes made outside the control panel.

Any info is appreciated.

Thanks,
Jon
 
DA would be aware of all the changes, if they were done right. You would need to know which files needed to be modified for what task. When creating scripts, the place to look for files that need changing are:
/usr/local/directadmin/data/users/${username}/*
/usr/local/directadmin/data/admin/*
/usr/local/directadmin/data/users/admin/*
/etc/virtual/domains
/etc/virtual/domainowners
/etc/proftpd.passwd
/etc/proftpd.conf
/etc/ssh/sshd_config
/etc/virtual/${domain}/*
/var/named/${domain}.db
/home/${user}/*

When a * was used, that means all files and subdirectories. It is not that hard to figure out how all the files fit together. I think I got all the files, and directories. For the most part, DA will look to the /usr/local/directadmin/data/ directories for storing their information.
 
With several exceptions...

The individual user-level httpd.conf files are rewritten whenever something is done that would change them. The only way to keep your changes would be to install them through the control panel (as admin).

The DNS zone files keep all their lines, but the other characteristics (SOA, serial number, TTL, etc.) will change when they're rewritten.

And perhaps others I'm not thinking of.

DA has a templates directory. While this directory could be overwritten by version updates, there's also a templates/custom directory; anything in the custom directory won't ever be changed.

Jeff
 
I had an issue with the way DA modifies vhost httpd files the problem is it adds changes to the bottom instead of top so if the same value is twice and you are trying to overide the default takes precedence, I emailed john on this but I dont think hes going to change it. So to workaround I used freebsd's chflags schg option which basically stops any user modifying the file.
 
My understanding (from reading apache documentation) is that when a configuration flag appears more than once apache follows the last one it finds.

Linux has a similar optoin, chattr, but my understanding is that John's doing it right.

Jeff
 
I am talking from experience, it uses the first line.

and apache reads from bottom up :)
 
Last edited:
Am I confused?

According to this actual test I just ran:
Code:
        ServerName [url]www.nobaloney.net[/url]
        ServerAlias [url]www.nobaloney.net[/url] nobaloney.net
        ServerAdmin [email][email protected][/email]
        DocumentRoot /home/nobalone/domains/nobaloney.net/private_html
        DocumentRoot /home/nobalone/domains/nobaloney.net/public_html
        ScriptAlias /cgi-bin/ /home/nobalone/domains/nobaloney.net/public_html/cgi-bin/
This code is entirely in the <VirtualHost 65.58.240.230:443> container.
And when it's installed for testing, entering:

https://www.nobaloney.net/

into the browser window results in my browser showing me the contents of the public_html directory.

Which means apache is using the bottom-most configuration directive.
Code:
I had an issue with the way DA modifies vhost httpd files the problem is it adds changes to the bottom instead of top so if the same value is twice and you are trying to overide the default takes precedence,
which leads me to believe you wrote it would use the the topmost directive.

But you also wrote:
I had an issue with the way DA modifies vhost httpd files the problem is it adds changes to the bottom instead of top
and when I try modifying the domain specific httpd.file my change gets added at the top, not at the bottom (see the line for /home/test below):
Code:
<VirtualHost 65.58.240.230:80>
DocumentRoot /home/test

	ServerName [url]www.test.nobaloney.net[/url]
	ServerAlias [url]www.test.nobaloney.net[/url] test.nobaloney.net 
	ServerAdmin [email][email protected][/email]
	DocumentRoot /home/nobalone/domains/test.nobaloney.net/public_html
	ScriptAlias /cgi-bin/ /home/nobalone/domains/test.nobaloney.net/public_html/cgi-bin/
So now i'm more confused than ever.

:(

Jeff
 
Ok sorry I might have wrote it wrong and got myself confused, basically DA adds the line at the wrong end of the file which is the top. This works fine if it is a new setting and not changing a current setting, however if I have say a default open_basedir setting and want to overide it DA will add my new setting at the top but because it reads from the bottom it reads the other setting first taking precedence so DA should be adding the line to the bottom.

For example I added

ServerName donotowork.com
ServerAlias donotwork.com

in the custom httpd configration box.

And the config shows like this

<VirtualHost x.x.x.x:80>
ServerName donotowork.com
ServerAlias donotwork.com

<rest of file>

But the domain still works, why? because the default setting already in place is taking precedence.
 
Your explanation is still confusing. I pulled out a book...

Apache reads its configuration lines from the top, building a table. Every time it reads a new configuration line for the same scope and configurable item it updates the table.

So by the time it gets to the bottom the end result is the same.

I'm going to ask John to look at the thread.

Jeff
 
Hello,

If you need to move where your customizatin is put inside your virtualhost, you need to copy the virtual_host*.conf templates to the custom folder, then edit your copied virtual_host*.conf files and move the |CUSTOM| token to where you want your additions to show up. http://help.directadmin.com/item.php?id=2

It's impossible to predict where admin would want it, as there are many different things you cando, so we add it to the top (so that your can redefine tokens). Past that, you'd need to move the CUSTOM token.

You guys were talking about 2 things, the way apache reads in configs, and where DA is putting the CUSTOM data into the virtualhost. Likely why you're confused ;)

John
 
yeah John that will fix it I just move the |CUSTOM| to the bottom and it will fix the issue. Thanks.
 
Back
Top