Crap, really screwed something up, all my virtualmin servers are GONE - sorta emergency here

That would be the default web page out of /var/www/html. So…did you reinstall httpd and get a default httpd.conf?

no i didnt reinstall - but i did somehow lose my httpd.conf… NO it was not backed up.

So, it sounds like you’re still trying to dig.

Your goal is not “make Virtualmin show me domain names again”. That’s an easy problem to solve. Your goal is “make sure no data is lost”.

So, do what I suggested. Start looking at what remains undamaged. Do you have system users? Do you have user homes with your websites/apps? Do you have your databases?

1 Like

hello joe – thanks for working so late to help an idiot like me.

everything seems to be intact except for httpd.conf - that was destroyed and not backed up.

i do have the following backed up as per this line that gets run nightly:

/usr/sbin/virtualmin backup-domain --virtualmin config --dest ${BACKUPDIR}/virtualminBackup ;
three files created & saved:
virtualminBackup.info
virtualminBackup.dom
virtualminBackup

can this salvage me?

EDIT: all db’s are there, the /home/ directory remains untouched.

what may kill me is how I had several ports proxied in httpd.conf - hopefully I can find documentation of how I did it.

OK, but you also said you don’t have your domains showing up in Virtualmin? If you can edit your domains in Virtualmin, you can disable the Apache / Apache SSL Website features and re-enable them to recreate the VirtualHost. But, if you don’t have domains listed in Virtualmin, you can’t do that and need to recover httpd.conf another way. Though I guess if httpd.conf really was completely deleted, you must restore that file. Virtualmin would only recreate VirtualHosts, it does not create a whole httpd.conf.

And, yes, if you have Virtualmin backups, nearly everything can be fixed. Virtualmin backups do not have the complete http.conf, they only contain the VirtualHost sections managed by Virtualmin. They are domain backups, not system backups. We recommend you also keep system backups, or at least backups of configuration files (all of /etc), for situations like this.

Check git status as I suggested above. That is probably the best way to restore you httpd.conf to the state before the problem occurred.

Let’s take it one problem at a time. So, let’s focus on getting httpd.conf back, one way or another. If you have a git repo for /etc, use that first, as that will get back all your proxy rules and everything else.

no sorry for misunderstanding - MOST domain names are showing up, but the most important one is not.

that is why I wanted to just create it again.

EDIT: I took my least important one and renamed:

/home/virtualaska.com to /home/virtualaska.com-SAVED/

and recreated the virtual server - but oddly this didn’t change httpd.conf at all.

You do not want to create it again, if the user home exists. And, presumably the user in /etc/passwd. Again, saving data is the goal, and getting your websites up again. Getting Virtualmin working again is a leisurely side quest that happens easily once the core problems are resolved.

You want to import it.

But, to do that, we probably need a VirtualHost for it.

So, let’s restore your httpd.conf first. Whether from git or via reconstructing it starting from using the reinstall feature of dnf (preferably from git).

Have you reconfigured Virtualmin to create VirtualHosts in separate files or an alternate file?

i am far more confortable using dnf than I am git (all I have ever done is git clone)

should i reinstall apache then? or can you give me the git instructions?

dnf does not have backups of your files. git will, if you have etckeeper working on your system.

no etckeeper…

OK, then I guess you have to do the worst thing.

Let’s confirm, though, none of your sites exist in httpd.conf?

If not, what is in httpd.conf? Was it really completely deleted? You said you created a new domain and looked in it to find it wasn’t added, so what were you expecting it to add a VirtualHost to?

whenever I created a new virtual server, it would previously add probably 50 or so lines to httpd.conf for both 80 and 443 ports.

my current httpd.conf is not completely empty though.

EDIT: my webmin system information is now blank. its not showing me that error that started all this out anymore at least.

OK, so, as I mentioned, Virtualmin doesn’t create an httpd.conf. It has no idea how. It adds a VirtualHost to an existing httpd.conf. I’m not sure what it does when that file is mostly empty, and presumably invalid. It certainly can’t fix it. Virtualmin doesn’t contain a full httpd.conf or knowledge of one (neither does Webmin, it just knows how to parse it and modify it).

So, back up what you have. I would just back up all of /etc/httpd somewhere safe (and not in the /etc/httpd directory under a different name…copy it somewhere far away, like /root or another system). Maybe there’s nothing useful in there, but, I don’t know, so assume you might need to look at it.

Then do this:

rm /etc/httpd/conf/httpd.conf
dnf reinstall httpd

Assuming that works without error, and you now have a default httpd.conf in /etc/httpd/conf (it should be a quite large file), we’ll proceed from there.

Stop messing around in Webmin. There is nothing good to be done there yet.

Though random things breaking in Webmin generally indicates either hardware or some other systemic failure. Do you know why your httpd.conf got deleted? If not, maybe that’s also a symptom of disk failing or similar.

my httpd.conf was never completely empty, but all the important contents were removed.

ok just did the dnf…

I don’t know what that means. What is “important contents”? You said above it was deleted.

If “important contents” just means VirtualHosts, then dnf reinstall absolutely cannot help make things better. The package doesn’t have your VirtualHosts in it.

sorry for misunderstanding - the old httpd.conf file was never completely empty, but it did lose all of my virtual servers.

does restoring these help at all?

virtualminBackup
virtualminBackup.dom
virtualminBackup.info

here is my virtualmin server list (I probably should delete this after we are done) -strangely the most important one is missing

Yes, you can restore individual features from backups.

But, now that you’re finding random things falling apart in Webmin, I don’t know that I would trust trying to do more things until you figure out what’s actually going wrong.

Check the kernel log (dmesg), the Webmin error log (/var/webmin/miniserv.error) for clues about why things aren’t working. If this is physical hardware (not a VM) you can use smartmontools to check for disk problems.

do you think there are more serious underlying errors? i figure when I stupidly deleted all the virtual servers in webmin this is what was causing everything to happen.

EDIT: looking in logfile, nothing looks unusual

tail -50 /var/webmin/miniserv.error