restoring virtualmin backup breaks apache configuration


I am experiencing some apache configuration errors when restoring a virtual-server. I am moving from ubuntu 12.04 LTS server to 16.04 LTS server, each running virtualmin 1.831 professional. I am using php fcgid mode on both servers, and so long as I clear up the apache configuration errors, Apache comes back up just fine.

It should also be noted that I am using the ppa:ondrej edition of php 5.6 for site backwards compatibility.

The apache configuration is the same regardless of a gui or commandline restoration.

The file ending in "orig.txt" is the original apache configuration, and the other file is the modified apache file as a result of restoring a backup.

I note several things:

1) the Options directive on line 13 has been modified to read "+All" which apache 2.4 does not allow. I must strip this + sign to have apache restart properly. 2) the extra options in the AllowOverride statement on line 16 have been stripped. (it seems fine, but suspicious) 3) I also note that "allow from all" is still present on line 27 (line 24 in the original file), and "require all granted" has been added.




Howdy -- thanks for contacting us!

After making the changes you described above, are things working properly for you?

Or are you still seeing some errors after that?

If you're still seeing errors, what errors are occurring?

They do work, once i make these changes.

Do you happen to know which Virtualmin version was used to create those domains originally?

unborn's picture
Submitted by unborn on Fri, 03/17/2017 - 07:41 Pro Licensee

hi guys..

just note to everyone. update from ubuntu 12.04 LTS to 16.04 will break configs within apache and that is because its too huge jump between versions. 12.04 = apache 2.2 and 16.04 = apache 2.4 and few configurations are different - they are not compatible. I faced this issue on my debian when switching from debian 6 to debian 8 without reading apache docs properly. It was mentioned with small warning on website - Latest News section.

@ Jason at eROI

what I would suggest is to do backup manually - I mean you will have a bit pain as you will have to recreate everything manually and then upload public_html folders to new servers. Exporting emails for each domain should work as it was worked for me - in backup performed by virtualmin. Be prepared that some sites will may not work for you as old / outdated htaccess can cause some small issue.. if that will happen, just rename .htaccess to tmp.htaccess and check your error logs to see that cause the issues, then alter htaccess to make it work as before. Databases should not be a problem with virtualmin backup as well. You can search about those changes regards apache2.2 and apache2.4 on google.

Hi Unborn,

You are right about the change of ubuntu and apache's major version. I wish I had time to determine where in the code the apache config is tailored from the server template to actual apache version, as well as where it's altered in a restore...Perhaps I could tweak it...

So maybe that's the major bug here: virtualmin's confused about altering apache versions...

At the moment, I have an intermediate script running to alter the contents of the backup files, as I need to properly port latin1 character sets in the mysql databases to utfmb4, So I am already commenting out a php_admin_value which is superfluous.

With the restoration as it is, a simple sed script does it to tidy up the apache configurations, it's why this is a bug report rather than a support request.

I am REALLY happy I am not handling email, or mailboxes...


I will take a look at the Virtualmin restore code to see if it can handle this case better - in an ideal world, any Apache directives that are not supported by the target system's Apache version would be fixed.


At the moment, I get around this by running the following sed script on all of the apache configuration files:

sed -i -e 's/^Options .All/Options All/i' -e 's/^\(php_admin_value\)/#\1/' /etc/apache2/sites-available/${domain}.conf
unborn's picture
Submitted by unborn on Wed, 03/22/2017 - 05:46 Pro Licensee

@ Jason at eROI

Nice solution! I am sorry but I did not kept old apache conf files.. If have them, I would do git repository for old and then new.. so changes could be seen within diff.. like what was changed in each file, but as I did not kept apache 2.2 configs anywhere nor in my backups while I was updating my personal servers I cannot provide this. If you have by any change apache 2.2 configs and you would not mind to share them, I can create public git for you with those changes. And it will be very easy to read what is new or what was changed in new configs.. so you would be able to track them all and also could alter existing config.. all in one go for all (i guess if you would write small - perhaps I could write this for you)