Moving from LAMP to LEMP - Restore to a new server fails

Hello,
Ubuntu 18.04LTS
Fresh install

Virtualmin LEMP fresh install

All this wen fine, the problem is about restoring the domains.

I started with one domain from a full backup.

The domain validation says that can’t restore apache related configs, but runs to the end.

For some reason, after restore, the new domain doesn’t appear in the virtual server list.
If I try to restore again, it complains that the virtual server already exists.

What is wrong here? How do I force it do show the newly inported domain from backup?

Thank you.

Hello,

Anyone to help ?

Thanks.

Do you see the partially restored domain in Webmin -> Servers -> Nginx Webserver: Virtual hosts box / Apache Webserver: Existing virtual host tab?

If you do (you likely will) then you need remove the partially restored domain to be rid of “virtual server already exists” objection.

Hi.

Thank you for the info.

It wasn’t enough, it then complained about existing user.

So, to avoid the cleanup procedure, I’ve re-installed the server again and created a snapshot of it with virtualmin installed only.
This way I can easily revert to this point.

So after this, I’ve tried again restoring one of my domains from the LAMP server backup, and once again, it didn’t add it to the virtual server list.

How can I debug this ? I need a way to import my servers if possible.

Help appreciated, thanks.

One additional note.
I’ve installed this server with XFS file system, and it complains that can’t enable quotas.

Can this be related ?

Ah, I missed telling you about this. Like the entry for domain in the web server, the user too should have been manually removed from Webmin.

I couldn’t find it where to remove, so just re-installed.
I’ve the snapshot now, it’s easy to revert. :slight_smile:

Can you help regarding the domain not showing?

One thing, I think the process doesn’t finish, because I don’t get the return button in the end of the import process.
Could this be related to php timeouts ?

Managed to fix quotas issue.

It seems this link is still valid!

needed to run grub-mkconfig again to fix this, even using ubuntu…

Hello again.

I decided to do it in command line, houping to see more things.

So basically the script exhausts all the memory (32G) and then gets killed.

(…)
Creating Nginx virtual host …
… done

Starting PHP FastCGI server ..
.. done

Adding webserver user www-data to server's group ..
.. done

Setting up scheduled Webalizer reporting ..
.. done

Creating SSL certificate and private key ..
.. done

Killed
root@server:~#

How can I debug this further ?

The command used was:
virtualmin restore-domain --source /backup/full/date/domain.com.tar.gz --domain domain.com --all-features

Help appreciated.

I don’t think there is any support for restoring an Apache domain into nginx. I don’t see how there could be, as the config files are wildly different and nginx lacks a ton of features Apache has.

Hi Joe,

Moving websites would be easy, I’m more concerned with mail and databases.

If it’s not supported, I’ll try to import mail and SQL only, if this creates the domain and put this features on, will be a great advance.

But I’ve tried already without the web data and failed.

What would be the proper feature set to create virtual server, accounts, mail and sql only ? I would like to do it in command line.

Thanks.

I’m not sure, honestly, it’s not something I’ve ever done. And, yes, not having a web feature is gonna choke Virtualmin on restores. We never anticipated not having or wanting the web feature (though in this case it’d make sense to restore everything except web and then enable web after with nginx and modify the settings manually to suit the site in question). There is probably some way to trick it into doing most of the work, but I don’t have a strong sense of how.

I talked to Jamie about it, mostly just to ask him to make the error much more clear that restoring from Apache to nginx is not possible, and he responded that maybe he’d be able to make it possible. So, maybe it’ll show up in limited form in a future version…but, no promises. It’ll never be a 1-to-1 mapping because they’re very different servers and nginx just can’t do a bunch of stuff Apache can, but for a lot of folks, it’ll be sufficient, and at least would get you through the “can’t get there from here” problem you currently face.

One avenue you might try is installing/enabling Apache (disabling nginx), doing all of your restores, and then converting the server to nginx and manually fiddling with the web server bits. I would never suggest this in normal circumstances, since it’s a bunch of manual steps to switch between servers, but it’s probably less work than restoring all the pieces manually.

Hi Joe.

I’ve found this in one post.

"
Submitted by JamieCameron on Tue, 03/05/2019 - 00:21 Comment#5

Yes, a global migration would be possible. Basically, you could do the following :

  1. Disable the Apache feature for all domains.
  2. Turn off Apache globally on the Features and Plugins page.
  3. Shut down Apache webserver, and install and start Nginx.
  4. Enable Nginx on the Features and Plugins page.
  5. Enable the Nginx feature for all domains.

The down side though is that any custom apache settings, redirects or PHP versions will be lost.
"

Is this still the correct procedure?

I can try this in a MW, a long one.

1 Like

Yes, that’s what I was suggesting above, though Jamie was much more clear about it. :wink:

So I re-tested this feature, and moving between different webservers (Nginx to Apache) via backups does work. I’ll test the other direction too …

1 Like

Also, a transfer from Apache to Nginx worked fine for me…

I went through this earlier in the year and IIRC, there’s wasn’t much as far as history on the forums here to guide me.

Jamie said it is expected to work (with obvious limitations based on them being very different web servers with different capabilities), so the problem OP reported is bug-like, but we’d need to get more info to fix it.

Hi!
I’m trying to do the backup excluding the not supported features, but --exclude-feature is ignored.

virtualmin backup-domain --domain domain.com --dest /backup/tmp --all-features --newformat --except-feature “Apache website” --except-feature “SSL website” --except-feature “Slave DNS domain”

Starting backup…
Creating backup for virtual server domain.com
Copying virtual server configuration …
… done

Backing up Cron jobs ..
.. none defined.

Saving mail aliases ..
.. done

Saving mail and FTP users ..
.. done

Backing up mail and FTP user Cron jobs ..
.. none to backup

Backing up 1 user's home directories ..
.. done

Copying Apache virtual host configuration ..
.. done

Copying Apache log files ..
.. done

Copying Webalizer configuration files ..
.. done

Copying SSL Apache virtual host configuration and certificate ..
.. done

Copying Logrotate configuration ..
.. done

Dumping MySQL database db-name ..
.. done

Copying Procmail and SpamAssassin configuration files ..
.. done

Backing up slave DNS zone configuration ..
.. done

Creating TAR file of home directory ..
.. done

… completed in 1 hours, 1:13 minutes

1 servers backed up successfully, 0 had errors.

Backup completed successfully. Final size was 11.7 GiB

root@server:~#

How do I properly exclude the features ?

Ok, so finally one step forward.

I’ve finally found a way to proceed.
So since the exclude-feature didn’t work, I’ve tried dissociating the apache and ssl features from the domain.
This of course causes a downtime, the webpage stops.
At this point I do the backup.
when complete, I associate the features again in prod server.

Then for restoring, I do a normal all-features restore, and this time it works!!!

I’ve the domains imported, but just with no web features activated.

I’ll now proceed with tests, I’ll reactivate web features in test LEMP server and see if I can get the webpages working.