How to create Webmin subdomain?

Hello,

I tried to create Webmin subdomain using this tutorial.
I can connect to PHPMyAdmin using the url “https://mysite.com/phpmyadmin” but I want to connect it using “https://phpmyadmin.mysite.com/”.

I added in OVH Zone DNS :
Domain: phpmyadmin.domain.com. TTL: 0 type: CNAME target: domain.com.

in Webmin now

1 - go to Servers > Apache Webserver.

2 - From that page, we select “create new virtual host”.

3 - Handle connections to address: We select the specific address… : “the IP address”,
Server Name : “phpmyadmin.mysite.com”,
Document Root: We enter the path of sub-domain : “/home/mysite/public_html/phpmyadmin”

1 - after Iadded the “A record” via Webmin. We go to Servers > BIND DNS Server.

2- Next, we selected the zone of the parent domain and clicked on “Add Record To Selected” button.

3 - In new Record Name field, we entered the subdomain name. “phpmyadmin”
In new record field, we entered the IP address.

when I try to connect to “phpmyadmin.mysite.com” on Google Chrome, I redirected to “www.phpmyadmin.mysite.com” and I have an error “DNS_PROBE_FINISHED_NXDOMAIN”

Thanks
Debian 12
Webmin 2.105

How did you install phpmyadmin, from virtualmin’s add script function ?

  1. In OVH zone DNS, add an entry for www.phpadmin.mysite.com.

  2. In your apache VirtualHost, you should add these lines if they’re not already there:

ServerName www.phpadmin.mysite.com
ServerAlias phpadmin.mysite.com
  1. Easier way, install virtualmin on top of webmin, and it’ll do all these small steps for you automatically, you only need to click “create new virtual server” and type your subdomain name.

What appears in the error_log and access_log when you try to visit the site?

The redirect is Chrome automatically doing it, nothing to do with your Apache config in this case (though it’s possibly you have an .htaccess file doing it), and it’s probably doing it because it can’t find the name you tried in DNS.

Why did you do this? Above you said you were adding records to your registrars DNS. You’re either hosting your DNS in your registrars servers or in the DNS server on the Webmin server. You almost certainly aren’t doing both (and you definitely shouldn’t be doing both, as the odds of sync problems and difficult to diagnose intermittent DNS problems is very high without automation).

An alias for www isn’t needed if the configuration and DNS is right. And, an alias won’t help until DNS and configuration is right.

I don’t understand the redirection in chrome “phpmyadmin.mysite.com” to “www.phpmyadmin.mysite.com
I removed the .htaccess
I don’t have this redirection for “mysite.com
I can ping “phpmyadmin.mysite.com” but not “www.phpmyadmin.mysite.com

I explained all that.

1 Like

I don’t know if it’s a Webmin or an OVH problem
I don’t see redirection in Apache conf file

It’s obviously not a Webmin problem, Webmin is not the web server nor is it the DNS server. It’s not an OVH problem, either, most likely.

Seems pretty obviously to be a misconfiguration.

When you ping the hostname, does it ping the right IP address for your server?

If so, then we can narrow it down to your Apache configuration, so you need to look at the error_log and access_log for clues, as I said already.

the ping return the right ipv6.

Have you configured IPv6 correctly in Apache for this VirtualHost?

And, again, I am begging you to look at the damned logs.

I have no log, I need to add in Apache VirtualHost ?

ErrorLog /var/log/virtualmin/mysite.com_error_log
CustomLog /var/log/virtualmin/mysite.com_access_log combined

You have a log. There is always a log. If you don’t define a custom one, it’ll log to the main Apache logs.

You’re not using Virtualmin, are you? That’s where Virtualmin puts the logs for the VirtualHosts it manages. You have no reason to use that directory.

I created the VirtualHost “phpmyadmin.mysite.com” using Webmin.
I have the log for “mysite.com” in virtualmin but not for “phpmyadmin.mysite.com

What the hell?

You have Virtualmin, but you’re using Webmin to create virtual hosts and install applications? Why are you doing this to yourself (and us)?

You’re right, I added the ipv6 in “/etc/apache2/sites-available/phpmyadmin.mysite.com.conf” and I see the php code, but php doesn’t work ?
I added the log too.

Why, I see this tutorial (link to blogspam removed), and I don’t know how to create a subdomain using Virtualmin.

Please do not use anything you find at bobcares.com. It’s blogspam and very often wrong.

You’re right.