Converting Migrated cPanel Subdomain to Subserver Wiped Out the Sub

OS type and version Rocky 8.7
Webmin version 2.001
Virtualmin version 7.3 Pro
Related packages None

This is a continuation of this topic; but I’m making a new topic because it’s a new problem, and I want to keep Joe happy.

Once again, my general mistrust of computers paid off.

I decided to convert the unused “m” migrated cPanel subdomain to a subserver to see what happened, and it worked fine. So I did the same with a live subdomain, and it disappeared. The whole sub went 404. The directory where it used to live was gone. Nada. No mas.

More precisely, the files got moved from




But apparently, no one told Apache about it because https://sub.domain.tld still points to


which, of course, was nonexistent, having been deleted and its contents moved.

In the best tradition of kludges and quick-fixes, I re-created the subdirectory and copied all the files into it, and now the sub is back online.

But it’s first aid, not a fix.

On the bright side, converting the migrated subdomain to a subserver does in fact restore the option to enable Awstats. It just wipes out the site in the process. Hey, nothing’s perfect.

So… How do I fix this?

I left the files in


in place and made a minor edit to the 404 page that will enable me to know when Apache is pointing to the right directory. (I changed “file or resource you requested” to “file or resource that you requested,” adding a grammatical improvement that will make my grade school English teachers proud, wherever they are.)

I’m guessing that I have to manually edit httpd.conf; but because my guesses seem to suck more than usual today, I’m calling on the Wise Ones for advice before doing so.



Looking at httpd.conf, converting the subdomain to a subserver didn’t change the document root. That smells like a bug in the conversion routine to me.


EDIT: None of the paths for the virtual host were changed.

The Virtual Host was updated for Port 80, but not Port 443. So I have to correct the entries in that section. The reason it came up 404 was because I’m forcing https.

Okay, that fixed it. Correcting all the paths for the Virtual Host:443 block points Apache to the new location for https.

This appears to be a bug, specifically, the block for :80 is updated when converting the subdomain to a subserver, but not for :443.


Actually, I spoke too soon. It enables the option, but selecting the option to enable Awstats fails on the converted subserver.

I have to ponder this for a while.

As an aside, because Virtualmin is intended to simplify things…

cPanel has, at times, created subdomain root directories under /public_html/ of the parent domain. For example, the root directory of


would be located at


Because the process of converting the cPanel subdomain to a subserver moves the files to


where they belong, why not preserve the now-empty directory


and mount the new directory in it to preserve remote users’ upload paths?

mount --bind /home/use/domains/sub.domain.tld/public_html/ /home/user/public_html/subdomain/

That would make the new location accessible to FTP, etc. without site maintainers having to change the directory structures or upload paths on their ends.



I’ve converted all the subdomains to subservers.

Other than the previously-stated problem with the VirtualHost entries for 443 not being updated, there was one other very peculiar problem: One of the conversions caused the DNS entries for a different subdomain to disappear.

I really have no idea how that happened. I do know it was the first subdomain created on the site, so it’s probably 10 to 15 years old. Maybe there was something peculiar in the way cPanel configured things back then? I really have no idea.

In any case, it was easily fixed.

I also created a shell script to mount --bind the former Web roots to the new ones to preserve the SFTP links. I was going to do it in fstab to make it persistent; but I decided to do it as a shell script, basically because I’m not sure whether I’m going to keep it.

The reason I did that is because all except one of the subdomains were parts of the same site, and all the Web roots were in /public_html/ for the parent domain, both on cPanel and on my local computer; and they are part of the same “project” in my IDE.

To preserve the upload paths, I either have to duplicate the file structure all the way down to /home/user, or split the subs into separate projects, because there’s no way that I know of to specify separate upload paths for the new directories as long as they’re part of the same project.

Splitting them up would create all kinds of havoc for previews, but I may duplicate the file structure. For now, mount --bind is good enough and is easily undone.