DocumentRoot is different for mysite.com and www.mysite.com

I have discovered where the issue is, but I am unsure how to use Virtualmin to fix/edit the problem.

What I experience:
www.mysite.com uses /home/mysite/public_html/ to pull up index.html
mysite.com uses /var/www/html/
My DNS is set up correctly.

In mysite.conf file under etc/apache2/sites-enabled/
mysite.com is set up with a document root /home/mysite/public_html
(FWIW, 000-default.conf is also enabled in this folder)

When I type apache2ctl -S in the command line, however, the
MainDocumentRoot: “var/www/html”

I’m not very command line savvy, being a newbie, but I also want to use the Virtualmin web interface as much as possible. It has to be something simple, but I’ve looked everywhere and I’ve exhausted everything I’m capable of doing on my own.

thanks!

This is a FAQ (really, it comes up every few days): https://www.virtualmin.com/documentation/web/troubleshooting#toc-the-wrong-site-shows-up-V5JtxdKg

Quick answer:

Disable 000-default.conf. You can tell Virtualmin to make another site the “default”, but “default” doesn’t have a very useful meaning in a name-based virtual hosting system. (Sometimes, the first VirtualHost Apache finds is the “default”, which is why 000 is stuck on the front, but there are several ways for that to not occur, so don’t rely on that behavior if you can avoid it. Always use names.)

The other option, if you don’t want to disable 000-default.conf for some reason, is to make sure every VirtualHost section uses the same convention for IP:port. e.g., they either all need to be ip:port or *:port. They cannot be mixed or behavior will be confusing. There are rules for how Apache determines what to show, but nobody understands them. So don’t rely on them.