How do users access their site without ~userdir enabled?

RADRaze2KX

Verified User
Joined
Jan 4, 2024
Messages
35
Servers:
1.) WordPress (our sales funnel site)
2.) WHMCS (the "store")
3.) DirectAdmin (cloudlinux w/ CageFS, MySQL Governor, PHP Selector, Softaculous)

I feel this is a stupid question, but the documentation isn't clear, and searching for answers on Google brings up posts from literally 20 years ago.

In a situation where a client is buying WordPress hosting from our WHMCS server and it's provisioned in DirectAdmin, how do they access their site without userdir (hostingdomain.com/~userdir) enabled if their domain hasn't propagated yet?

I'm asking this seemingly obvious question because it's led to down a rabbit hole that seems overly complicated to fix.

When Softaculous installs WordPress using all defaults to the freshly created user account, the wp-config.php file is set to DB_HOST = 'localhost', which is causing the site to get "Error establishing Database Connection". Changing 'localhost' to '127.0.0.1' fixes the issue, but I can't fix this manually for every site as their being created.

So I created a universal.custom.php file for Softaculous, to specify that it WordPress should be installed with 127.0.0.1. This made the sites install with 127.0.0.1 as the DB_Host but the sites are messed up when they're installed directly to the public_html of the user.

HOWEVER, if I install to a subdirectory of public_html, like "public_html/wp", the site installs and works just fine.

I then asked Softaculous support what the issue was, and they logged into the server and said it was fixed, and it's not (I deleted the testsite and recreated it from WHMCS -> [CREATE], and it's the same exact issue.

A lot of threads I've seen are about WordPress not liking the ~userdir directly and it causing issues. So I thought "well, I'd like to set it up so that the site is accessed at site.hostingdomain.com rather than hostingdomain.com/~site, but there's no documentation on how to do that for CloudLinux.

So I'm overly frustrated. I've been working on getting everything from our client-facing funnel site to WHMCS and CloudLinux and DirectAdmin polished and perfect. This last issue I've been trying to solve has doubled the amount of time I've spent doing this project.

Can anyone please provide me some guidance on how I can either:
1.) get DirectAdmin to set up new sites from WHMCS sign-ups to site.hostingdomain.com (like siteground does)
2.) assist me with figuring out why 'localhost' is causing database connection errors
or
3.) figure out how to automatically change the localhost to 127.0.0.1?

It seems like any one of these three being solved would solve my remaining issues but all of my posts to various forums have gone unanswered.
 
1. Configure your billing panel to add domain pointer with needed subdomain
OR add custom DA script /usr/local/directadmin/scripts/custom/domain_change_post.sh
2. Check mysql config for skip-name-resolv
3. can be solved with #2 or use some perl/shell/sed/awk script to parse+replace
 
I just blasted my entire server and started over and i think that fixed some of the issues.

I'm still curious how a user is supposed to start working on their wordpress site if they can't access. Do i HAVE to enable the ~userdir for it to work? Are there any disadvantages to doing so in 2024?
 
Nevermind, I've completely given up on ~userdir for wordpress. Gonna need to figure out a different way
 
userdir have security issued.

If you like to have temporary domains for your user. Just prepare your own domains and use it as "subuser1.domain", pointer to their home Dir.

I'm not talking how to do, So just use hooks script and everything programming you have.

Example: This's how to automate put custom nginx per domain into their virtualhost. so you can put something like "sub.yourowndomain.com" into virtualhost.
Code:
server_name domainname.com sub.yourowndomain.com;
 
Back
Top