Using the custom package item feature to alter user httpd.conf files


Enter Your Query:
Use '%' for wildcards and quotes for "exact phrases"


Top Level » DirectAdmin

Using the custom package item feature to alter user httpd.conf filesLast Modified: Jun 25, 2009, 4:59 pm
If you're trying to add custom features/options into DA pacakges, and want those to affect certain areas on the system (in this example, user httpd.conf file), you can do so using a combination of several features in DA.

- custom package items
- direct editing of /usr/local/directadmin/data/users/$username/domains/$domain.cust_httpd
- using domain pre/post script

1) The first step is to use the custom package item feature to add the checkbox/fields you want into the pacakges.

2) Then create the domain_create_post.sh script to grab that info from

/usr/local/directadmin/data/users/$username/user.conf

to make decisions as to what to alter, how to alter it, etc. (based on your requirements)

3) In this example, we want to change the httpd.conf, so have the post script edit/create:

/usr/local/directadmin/data/users/$username/domains/$domain.cust_httpd

and insert whatever code you need in it.  Be sure to run the command:

echo "action=rewrite&value=httpd&user=$username" >> /usr/local/directadmin/data/task.queue

so that the change you make to the $domain.cust_httpd file is applied.

4) Since this is a package option, any change you make to the package/user will alter the user, not the domain, so you'd need to also create

/usr/local/directadmin/scripts/custom/user_modify_post.sh

and have it repeat the same basic idea as for domain_create_post.sh, but in the case you're disabling the feature, to remove the code from the cust_httpd file, for all domains that belong to the user.
 
Related Helpfiles
I want to customize the User httpd.conf files based on a custom package item

© 2018 JBMC Software, Suite 173  3-11 Bellerose Drive, St Albert, AB  T8N 1P7  Canada.  Mon-Fri 9AM-5PM MST