On a stock Virtualmin server you may deploy a new website, only to find that instead of the new website serving the default (first site on the list) starts serving.
This typically indicates a problem with one of your .conf
files. Beware, it doesn’t have to be the .conf
file of the newly created site, but it could be elsewhere in your system.
The point is Virtualmin cascades all the .conf
files in a row and if any one of them fails then you will have weird problems as has been described.
A quick and easy way to check if something is amiss is by using the apachectl configtest
command. This is very similar to nginx -t
or nginx -T
.
Here is an example of a situation where a new site was created but instead of serving the new site, the default site came up:
root@cp:/etc/apache2/sites-available# apachectl configtest AH00526: Syntax error on line 91 of /etc/apache2/sites-enabled/abc.com.conf: SSLProtocol: SSLv2 is no longer supported Action 'configtest' failed. The Apache error log may have more information.
Use an editor to go an examine line 91 of that file:
root@cp:/etc/apache2/sites-available# mc -e /etc/apache2/sites-enabled/abc.com.conf
Comment out the old line:
# Commented out by Sysadmin on 02 Mar 2023 due to apache failing configuration test #SSLProtocol +SSLv2 +TLSv1.2 +TLSv1.3 SSLProtocol +TLSv1.2 +TLSv1.3
Please note, after fixing the problem you will have to use an incognito browser to see the fixed website. You might also have to do a hard refresh or try more than once to load the site. Chrome specifically caches DNS and URLs so it doesn’t recognise the new site until you do a hard refresh or until you use incognito. Even try another browser if this fails.