Disable Open Base Dir and change Document Root of domain with .sh script

chasedevelopmen

New member
Joined
May 7, 2015
Messages
2
Hello,

I'm trying to create a custom .sh script on user creation (when the created user has a certain package). I'm trying to do 2 modifications on the domain that was created with the user.

Is it possible to:
- Disable Open Base Dir of a certain domain with a .sh script?
- Change the document root (Custom HTTPD) of a certain domain with a .sh script?

Hopefully someone can help me out!

Best regards,
Nick Jansen
 
Hello Nick,

In general the both questions can get YES as an answer. You need to use TOKENS available for virtual host and create a custom file:

/usr/local/directadmin/data/users/username/domains/domainname.com.cust_httpd

and then trigger directadmin to rewrite httpd.conf for a domain (http://help.directadmin.com/item.php?id=2).

First I'd suggest that you create the desired config in Directadmin Web interface and see how it writes things in domainname.com.cust_httpd, then update your script to create the same cust_httpd for new domain.

Open basedir restriction can be cancelled, you did not specify PHP mode so that's up to you find a correct place where it's set: it's the same apache virtualhost config for mod_php and other places for PHP-FPM, PHP-FASTCGI, or suPHP.
 
Solution

Hello Alex,

Thank you for your quick and very helpful reply! Now the script echos my custom httpd-config in a file called domain.com.cust_httpd (location: /usr/local/directadmin/data/users/{$username}/{$domain}.cust_httpd).

After that, the script replaces open_basedir=ON with open_basedir=OFF in the domain configuration file (location: /usr/local/directadmin/data/users/{$username}/{$domain}.conf).

Last, the script adds a task for rewriting the user httpd.conf files.

Works like a charm,

Thank you!
 
Back
Top