Possibility to change script when creating users

Ramon Pego

Well-Known Member
Mar 12, 2019
55
10
8
Brazil
cPanel Access Level
Root Administrator
Twitter
I currently use Laravel framework for my sites and services, it works well but I always need to make manual changes to each user I create on the server.
By default the "home" folder of the sites on CPanel is public_html and laravel is public, so I always need to change this in the WHM files:
Code:
'var/cpanel/userdata/USERNAME/DOMAIN.COM'
'var/cpanel/userdata/USERNAME/DOMAIN.COM_SSL'
and after that run some scripts for these changes to take effect correctly:

Code:
/scripts/updateuserdatacache
mv /etc/apache2/conf/httpd.conf{,.bk}
/scripts/rebuildhttpdconf
/scripts/restartsrv_httpd
It was right here that I got this help on how to make this change and thanks again to you for that.

The question is whether there is a way today to make a more correct change that prevents these steps from always being done.

For example the content of these:
'var / cpanel / userdata / USERNAME / DOMAIN.COM'
It comes pre-written from a standard template if it is possible to edit this template.
Mais sobre o texto originalÉ necessário fornecer o texto original para ver mais informações sobre a tradução
 
Last edited by a moderator:

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
4,357
546
273
cPanel Access Level
Root Administrator
Hey there! When you change the document root are you using /home/username/public_html/public? If so, changing the directory root how you are doing is the best way, as that avoids the confusion of trying to use symlinks or redirects.

If you wanted to try some automation with that process I'd recommend checking out the Accounts::Create section of our hookable events here:

 

Ramon Pego

Well-Known Member
Mar 12, 2019
55
10
8
Brazil
cPanel Access Level
Root Administrator
Twitter
what i do is in the document:
var/cpanel/userdata/USERNAME/DOMAIN.COM and [...]USERNAME/DOMAIN.COM_SSL
change this line:
"documentroot: /home/user/public_html"
to
"documentroot: / home/user/public"
and the same in:


I already create accounts for an api that I developed, but they still have to go manually changing the "documentroot" of each newly created user.