._default_hostname created in home

Bug Report: Virtual Server Creation Fails When Domain Matches Hostname

SYSTEM INFORMATION
OS type and version Ubuntu 24.04 LTS
Webmin version 2.402
Virtualmin version 7.30.8
Webserver version Apache 2.4.58 (check with: apache2 -v)
Related packages Let’s Encrypt, certbot, mod_ssl

Issue Description

I encountered an issue when trying to create a virtual server with the same domain name as the server hostname.

Steps to Reproduce

  1. Fresh Virtualmin installation on Ubuntu 24.04 LTS
  2. Server hostname set to: example.mydomain.com
  3. Attempted to create a Virtual Server with domain: example.mydomain.com

Error Message

Failed to create virtual server : You cannot create a new domain with example.mydomain.com name, unless option Setup ACME SSL certificate for hostname is first disabled in Virtualmin Configuration ⇾ SSL settings page

Note: This exact error occurs when trying to create a virtual server with the same domain name as the server hostname.

Configuration Details

SSL Configuration Path: Webmin ⇾ Webmin Configuration ⇾ SSL Encryption ⇾ Let's Encrypt

In the “Let’s Encrypt validation method” section:

  • Selected: Apache virtual host
  • Chose the server hostname: example.mydomain.com

Unexpected Behavior

After configuring the SSL settings as described above, a directory was created:

/home/._default_hostname/

This appears to be incorrect behavior. The directory structure shows:

drwxr-x--- 11 _default_hostname    _default_hostname     4096 Apr 20 14:31 ._default_hostname

Expected vs Actual Behavior

Expected:

  • Should be able to create a virtual server with the same name as hostname
  • OR provide clear guidance on how to properly configure this scenario
  • Directory should be created with proper domain name, not ._default_hostname

Actual:

  • Error prevents virtual server creation
  • Mysterious ._default_hostname directory created
  • Apache configuration points to wrong directory paths

Current Apache Configuration Issues

The generated Apache virtual host configuration contains:

DocumentRoot /home/._default_hostname/public_html
ScriptAlias /cgi-bin/ /home/._default_hostname/cgi-bin/

Instead of the expected:

DocumentRoot /home/example.mydomain.com/public_html
ScriptAlias /cgi-bin/ /home/example.mydomain.com/cgi-bin/

Impact

This issue causes:

  1. Virtual server creation failure
  2. Incorrect directory structure
  3. Apache misconfiguration
  4. Subdomain functionality problems (webmail, admin, autodiscover not working)

Questions

  1. Is this the intended behavior when hostname matches the desired virtual server domain?
  2. What is the correct procedure for creating a virtual server with the same name as the server hostname?
  3. Why is the ._default_hostname directory created and how should it be handled?
  4. Should the SSL hostname configuration be different when planning to use the same domain for virtual servers?

Workaround Attempted

Currently considering renaming the incorrectly created directory:

sudo mv /home/._default_hostname /home/example.mydomain.com

But this feels like a hack rather than a proper solution.

Request

Could someone please clarify:

  • The correct workflow for this scenario
  • Whether this is a bug or intended behavior
  • Best practices for hostname vs virtual server domain naming

Any guidance would be greatly appreciated!


Additional Context

Timeline of events:

  1. Fresh Virtualmin 7.30.8 installation on Ubuntu 24.04 LTS
  2. Server hostname configured as: example.mydomain.com
  3. Configured Let’s Encrypt in Webmin with “Apache virtual host” method
  4. Selected server hostname (example.mydomain.com) in the SSL configuration
  5. This automatically created the problematic ._default_hostname directory
  6. Later attempt to create Virtual Server with same domain name fails with the error above
  7. Apache configuration incorrectly points to ._default_hostname instead of proper domain directory

Key observation: The ._default_hostname directory appears to be created during the SSL hostname configuration process, not during Virtual Server creation attempt.

Current filesystem state:

# In /home/ directory:
drwxr-x--- 11 _default_hostname    _default_hostname     4096 Apr 20 14:31 ._default_hostname
drwxr-x--- 13 example.mydomain.com example.mydomain.com  4096 Jul 13 20:21 example.mydomain.com

Note: The domain directory (example.mydomain.com) exists but has a typo (missing character), which suggests Virtualmin created it incorrectly or there was user error during domain creation process.


Additional Information

If you need any additional configuration files, logs, or system information, please let me know and I’ll provide them.

You should not do that. That is expected behavior so a ssl can be issued during installation.

As noted in many places in the documentation, you should not do that.

If you’re hosting email for that domain in Virtualmin, you need to change the system hostname. It’s just asking for trouble to try to virtually host something that is also the system name.

You can disable the hostname-based virtual server, but that doesn’t solve the problem of trying to make a single domain name be two things.