Subdomain equivalent of public_html (and related questions)?

Hi All,

Been a while (and no news is good news, oui?) so I hope you had a good summer:)

I have added two subdomains to my main VirtualMin server box, i.e., to “shawn.com” I have added new.shawn.com and dir.shawn.com. In response, VirtualMin has created a domains child directory at /home/shawn and within domains there are directories named, appropriately enough, new.shawn.com and dir.shawn.com. Within each of those are some folders (bin, etc, homes, logs, tmp) and a few hidden files.

In neither of the subdomain directories is there an index.php or index.html file, yet I am nonetheless directed to a “default welcome” page when I enter either URL (new.shawn.com or dir.shawn.com) into a browser.

In both subdomains I need to add some pre-extant folders and files but I am not sure where they should go within the above structure. I have also created two partitions in anticipation of making them the mount point for the subdomains, and put my folders/files in them, temporarily under /media/dir and /media/new until I know what the proper mount point is.

To that end, and please forgive my ignorance, what is the entry-root point/mount point for web-accessible files with subdomains of the above default structure, please and thank you?

My other question(s) - Having no idea what I’m doing, I “intuited” that, properly-speaking, the domain, and each subdomain should have their own internal IP, to which end I left shawn.com at 10.0.0.101 and added new.shawn.com to 10.0.0.108 and dir.shawn.com to 10.0.0.109, to wit:

I have also added the subdomains to my DNS providor’s config setup on their website, pointing them to my external IP, as with the domain itself.

Problem - the only way I can actually “land” on dir.shawn.com or new.shawn.com is by adding an entry into the hosts file on each LAN computer, i.e.,

10.0.0.108 new.shawn.com
10.0.0.109 dir.shawn.com

Otherwise, entering new.shawn.com lands me on shawn.com, the root. Externally, I also just bounce to shawn.com when entering either subdomain in an address bar. Any thought on what I have done wrong here?

As always, I appreciate any help here, especially as regards the webroot mount point for my subdomains.

Merci:)
Shawn

SYSTEM INFORMATION
OS type and version Ubuntu 22.04
Virtualmin version 7.7

I am no expert and you will probably want to wait for someone else to respond but I tend to set mine up differently.
When I define a new virtual server I always set mine up as top level servers. I find it easier to handle with all my servers in the same Home directory. It probably depends on how you plan to use them as well. In my case I have a dynamic IP provided by my ISP (separate from my home IP) That is assigned to my main server. I then ensure that all virtual servers are added to my DNS host records at my registrar. All internal routing is done by my server as all virtual servers are using the same shared IP.
If I need somewhere to do some experimenting I just create a new virtual server (top level) like test.mydomain.cloud and then I can do with it as I choose. Not sure of any drawbacks but it has worked for me.
I suppose that if you wanted the files stored in another location rather than /home/newserver you would just define the home location in your virtual server and point to whatever mount point you want?
Maybe here?

Apache at least doesn’t need internal addresses for virtual sub domains, it knows from where to sere the correct files.

Now it doesn’t with them internal addresses…

Just delete the subdomains, than recreate the subdomains as subdomains of shawn.com (is a button for subdomains), than put the files on /home/shawn/domains/NEW SUBDOMAIN/public_html

That is all you need to do.

Thanks guys. I deleted the subs and reinstalled. Per the screenshot below, in order to have SSL it appears I did need to have a unique IP for each sub. Internally, the subs work now. And as suggested above, they are at /home/shawn/domains/NEW SUBDOMAIN/public_html. And the partitions/mountpoints I made via UUID in fstab all work a charm:) Please chime in if you would suggest alternative best practices here:)

Unfortunately, with all of the changes I have made lately, I seem to have lost external access to my website altogether. Is there a config or log file with VirtualMin which might offer a glimpse of what I have and what should be, in this regard? Should the WebMin > Networking > Network Configuration settings all be set to “auto”?

Merci:)
Shawn

No! That text is misleading. You absolutely do not need multiple IPs for anything except virtual FTP hosting, and you absolutely do not need that.

I’ve fixed the help text. It had been correct in all the web server related places, but the interfaces-related help text didn’t get updated. You absolutely do not need extra IPs for anything.

The PR to fix it is here: Remove old IP-based virtual hosting help, as it's no longer necessary… by swelljoe · Pull Request #635 · virtualmin/virtualmin-gpl · GitHub

1 Like

It sounds like you’re the only person using the server (that’s a guess, and if wrong, you can ignore this). On my own servers, I create a new virtual server for every website. Sub-servers (not “Subdomains”, note…they have nothing to do with the name of the site, and “subdomain” is a name) are about ownership in Virtualmin and the filesystem. So, if you want one user, e.g. a customer, to manage multiple domains, you create a virtual server, and then some number of sub-servers under that parent domain.

If you own the whole server, there are security benefits to making every site its own user (in Virtualmin and in the filesystem). Since you have root, you can manage them all in Virtualmin, and you can configure your FTP client or ssh/sftp/scp to use the right credentials for each domain so if one site is compromised none of the others will be.

Oh, also, please open a new topic about networking questions, if you still have questions. They are wholly unrelated to your original question.

There will only be a button for subdomains if you imported cPanel backups that had subdomains (or Virtualmin backups that had been created from cPanel backups that had subdomains). We removed subdomains from the default configuration at least 15 years ago, and we strongly discourage their use (cPanel has also deprecated the subdomain site type, because I guess they realized after 20 years how dumb they are).

Virtualmin has sub-servers. They are full-featured sites with their own content that are owned by the parent under which they are created, and their data lives in /home/domain/homes/sub-server. They do not have to have a name that is a subdomain of the parent. There is no requirement that a subdomain named site be a sub-server, and there is no requirement that a sub-server be a subdomain named site. The two concepts are wholly unrelated.

In Virtualmin “subdomain” has no meaning (unless that weird old cPanel subdomain site type been turned on, but it should not be turned on). It’s just a name like any other.

2 Likes

Cpanel have change things again,“Addon Domains,” “Aliases,” and “Subdomains” were deprecated in cPanel version 100 and have been removed in version 106.

Was looking for it yesterday.

That was what I tried to say, thank you for clarification.

WOuld be silly to use subdomains because they are removed in last VIrtualmin, I was refering to 1, not to 2 that is inexistent.

This topic was automatically closed 8 days after the last reply. New replies are no longer allowed.