I’ve set up a new Virtual Server, but I’m encountering an issue with the default web directory. Currently, the server is displaying content from the /var/www/html directory, when I actually want it to display content from the public_html directory. Even though Virtualmin’s interface suggests public_html should be the default directory, this isn’t happening. Can you help me understand why this is occurring and how to configure the server to use public_html instead?
My directory structure is almost identical to yours, with one key difference: I have a nested ‘public’ folder inside the ‘public_html’ directory. This additional folder exists because I installed CodeIgniter 4, a PHP framework that requires this specific directory structure for serving web content.
And even before installing Codeigniter 4, public_html was the default. But the website’s showing the /var/www/html contents instead.
I believe the interface is attempting to redirect me to http://www.mysubdomain.mydomain.com/. When I manually enter this address in my browser, it displays the default Apache2 welcome page that comes with Ubuntu server installations.
We need to know you ran the script in the documentation on a fresh OS install that WASN’T previously configured. I’m not trying to be difficult but we need to know you didn’t install on a system already configured. This should work out of the box.
Nope. Virtualmin, the control panel, is run on a sub-domain as well.
Soimething like this:
Virtualmin control panel @ vmDOTmydomain.com
New virtual server website @ websiteDOTmydomain.com
nothing @ mydomainDOTcom
You’re setup seems strange to me, or at least the way I set things up. I set up a ‘top-level server’. If I want a separate structure for the ‘sub’ I set up a ‘sub server’.
I’ve only done this where I have Discourse forum software (docker) running. I don’t know it is the ‘right way’ but it works.
That’s an unusual problem. Normally Apache is either configured to serve VirtualHosts or it is configured to serve the “default” website (the one in /var/www). I’ve seen this occur in the past when people installed some web application from the Debian/Ubuntu repositories, as some packages include some web server configuration that overrides the usual config file.
So, if you installed any web application using apt, you should remove it, and install it instead into a Virtualmin domain (again, Apache can either host one website or many VirtualHosts, and the web app packages in the apt repos expect the former case). If you followed any documentation that included setting up Apache to serve anything outside of a VirtualHost, you need to undo that. As, once again, Apache can do one or the other, it can’t do both. In a virtual hosting environment, everything you serve should be configured inside a VirtualHost section.
If none of that sounds right, we’ll need to see what changes you’ve made to the Apache configuration files, so we can spot the trouble.