It isn't hard to do the only problem is getting a supported post hook to have new accounts have their own .conf file in the nginx configuration directory and just include every file in there.
It isn't hard to do the only problem is getting a supported post hook to have new accounts have their own .conf file in the nginx configuration directory and just include every file in there.
Let me introduce you to ..
/scripts/postwwwacct
That's for after creating a new account.
For the others, I'm sure cPanel has something in place or you can dig for that yourself.
If they don't offer it, you could easily have a cronjob that runs every 5 minutes for the others.
You can find some more information on /scripts/postwwwacct at:
ScriptHooks < DevHooks < TWiki
Domain parking, addon domains and domain forwarding are handled by cPanel API functions. Part of this API architecture is the ability to create function hooks to execute your own shell script after these functions are executed. You can read more about this at:
Hooking into cPanel Functionality
We have some documentation on the Addon Domains API functions at: AddonDomainRef < DeveloperResources/ApiRef < TWiki
We have documentation on Park Domains API functions at:
ParkRef < DeveloperResources/ApiRef < TWiki
The API 1 function call for adding a redirect (as used by the cPanel interface) is:
<cpanel Mime="add_redirect(path, type, url, domain, wildcard, rdwww)">
Mime is the module name
add_redirect is the function name
path is the path within the URL to redirect (if any)
type is either temp or permanent
url is the URL to redirect to
domain is .* if ** All Public Domains ** is selected, otherwise it is the domain/addon domain/etc to redirect.
wildcard is: 1 if this is a wildcard redirect
rdwww is: 2 if "Only redirect with www. " is selected, 0 if "Redirect with or without www." is selected, or 1 if "Do Not Redirect www." is selected.
I have moved our discussion about APIs and Hooks to a new thread in the cPanel/WHM Developer Discussions forum, where you are likely to receive more relevant feedback.
currently i know the file responsible for domain addon add and domain addon deleting which is doadddomain.html and dodeldomain.html.
how i can put a code on it so it will run /scripts/nginx.sh after a domain successful added or deleted ?
for doadddomain.html, i know it's should be put after the code below
and for dodeldomain.html it's should be put after the code belowCode:<cpanelif !$CPERROR{'addondomain'}> <cpanel print="$FORM{'domain'}"> <cpanel langprint="AODCreateYes">!<br /> <!-- <cpanel Ftp="addftp($FORM{'user'},$FORM{'pass'},$FORM{'dir'},,,$FORM{'dir'})"> --> <!-- If you would like to create an ftp account to upload files to this new domain, you can do so here: <a href="../ftp/addftp.html?domain$ <br/> <cpanel langprint="AODGoFileMgr">: <a target="_blank" href="../files/index.html?dir=<cpanel print="$homedir">/<cpanel print="$FORM{'d$ </cpanelif>
the problem is i don't know what is the syntax to run /scripts/nginx.sh (my nginx generation is nginx.sh)Code:<cpanelif !$CPERROR{'addondomain'}> <cpanel langprint="AODAddedPre"> <cpanel print="$FORM{'domain'}"> <cpanel langprint="RDRedRemText">! <br /><cpanel Ftp="delftp($FORM{'domain'})"> </cpanelif>
Please carefully review the documentation; this will be the best resource to help learn. If you have specific questions about something feel free to ask; however, if you need assistance creating something I would consider locating and hiring someone to develop the solution for you.
The following advertising forums might help with locating a company to help:
Server Management and Server Repair - cPanel Forums
For details and examples, please thoroughly review the following documentation; the following link that cPanelDavidG provided should help:
Hooking into cPanel Functionality
Additional, more specific documentation pages linked from the above:
WritingFunctionHooks < DevHooks < TWiki
ScriptHooks < DevHooks < TWiki
CustomEventHandler < DevHooks < TWiki
cPResources: Submit a Support Request - Submit a Bug Report - Review existing Tickets-- Donald cPanelDon Holl - Analyst, cPanel Quality Assurance