Wordpress Migration, WP upload limit, Multiple wordpress installs

Hellp guys, i’ve decided to make the jump from shared hosting to VPS using vultr.

1.) I wish to migrate my website to vps using easy engine. I have tried to do this using the all in one wp-migration tool however i need to increase the wordpress upload limit. I have tried changing the php.ini file. On one occasion it didnt change at all. I tried it again recently and restarted the website i.e. php and nginx but I kept getting an error for nginx and i think it broke the site. I wanted to install this website on a temporary domain initially to make sure that all the files etc are correct before I point the actual domain to the site. I tried using a wildcard domain by adding an A record to my DNS records on vultr but this didnt work.

2.) I wish to start another website on the same server. Will this clash with the other wordpress installation on the server?

thanks in advance

1 Like

Edit: Ok I know this post turned out to be like a Harry Potter novel, but it’s actually super simple and I probably just wrote things that I could easily edit out, but I noticed that with AiO you would have to use a temp domain, so I’ve written this guide so you can a) keep your website online during the entire process, no downtime and b) use your real domain URL on EE from the get-go, so you can create your site and import your backup without having to make any changes at all later on. I also figured maybe this guide would be useful for others in the future as I’ve given the same advice to a few different people in the last few days and they found it to be a really great solution. This method also allows you to have a 2nd Vultr EE server running using the same domain, with SSL, and you can use that for your staging environment so you make all your content changes there, test new ideas/themes/plugins/layouts etc and then when you’re happy with your changes you simply backup and restore to server #1 in a matter of seconds.

Hi @shab welcome to the ee forum. Would you be able to fully uninstall easyengine and start over? That would make things easier. Use sudo ee cli self-uninstall to do so. And then re-install it. Also, revert your A records back to the IP address of your shared hosting server so your website remains online to visitors during this entire process.

Delete the AIO migration tool from your shared hosting site. Install the UpdraftPlus plugin. I like Updraft because it splits everything in to its own zip (themes, plugins, uploads etc) so I don’t get 1 huge zip file. Also it will allow you to pull off this method of restoring to the same domain name and not having to use a random temporary domain, whilst keeping your shared hosting server online for all visitors except you, you’ll be taken to your EE server when you visit your domain.

First things first when it comes to migrating from a non-ee server, make a backup of your website as it currently stands and store this in a separate folder on your computer, call it Shared Hosting Backup or something, so you don’t get confused between all your backup sets. In Updraft just click on Backup Now, then download each file for that backup (database, plugins, uploads, themes, others. Also click on the log file and download that too.) For the sake of this post I will just make up the folder names myself but you obviously call them whatever you like.

And then we need to create a second backup, the one that we will be using in the migration to EE. We’ll need to make a few changes before we do this.

  1. If you use w3tc, WP Super Cache or any other caching plugins on your current website, deactivate and delete them. Then, install (but do not activate) these two plugins. Remember, do not activate them, it’s just that when you create a website in ee with caching enabled, it installs and configures these plugins for you – but if you restore a website that never had these plugins to begin with, they would naturally be deleted out of your wp database & directories after you restore.

  2. Now create your new backup for migration to EE. Download all the files including the log file to a folder on your computer, name the folder EE Migration Backup

Now that we have uninstalled & reinstalled easyengine, and created a backup set for the currently functioning website, and a modified backup for the migration, let’s begin.

The first thing you want to do on your EE server now is create your website. Let’s make a few modifications to the the create command to make things seamless. We’ll tell EE to make the WP admin username, password & email the same as what you are currently using on your existing website. We’ll also do the same for the database name, user, and password. This way your restoration will be absolutely seamless. To your question about the A record and wildcard – wildcard certs don’t use A records for verification. This means that you can actually use your real domain in the site creation (not a temporary one), and not have any effect on your live website that’s actually running. Normal visitors will see your current live website when they visit the URL, and only you will see the EasyEngine version, so you can do as much content changes/testing/updating as you want, without having to use some temporary random URL and then worry about URL replacements every time you want to restore/migrate.

Let’s create the website on our fresh EE install:

sudo ee site create youractualdomain.com --type=wp --ssl=le --wildcard --cache --php=latest --admin-user=yourexistingadminusername --admin-pass=yourexistingadminpassword [email protected] --dbname=yourexistingdbname --dbuser=yourexistingdbusername --dbpass=yourexistingdbpassword

If you are unsure of what the name of the database is, or the username or password to access the database, just open your wp-config.php file on your shared hosting website and you will find it in there. If you copy/paste it into your SSH terminal when entering this command, make sure you don’t accidentally add an extra space after the last letter, sometimes when I copy/past things an extra space is added by itself, so just keep an eye out for that.

If your existing website does not use SSL/HTTPS, skip the --ssl=le and the --wildcard flags when creating your site, and skip the verification process. Follow everything else. Once all done, scroll to my last post to instal SSL.

Now that you’ve created your website (for this guide I am assuming that your current site uses SSL, so you created your EE site with SSL. You will notice that EE has given you 2 TXT records that you need to add to your DNS to be able to get your wildcard certificates.

The TXT records both are for _acme-challenge.youractualdomain.com Create 2 TXT records for this with the verification keys that you’ve been given. Ps if you already have created these records from before, delete them instead of editing them. Set the TTL to something really low like 300. Your A records should remain pointing at your shared hosting IP address, so your website remains live – don’t point your A records at your EE server until you actually want to.

Now let’s issue and download the the wildcard certificates. Run sudo ee site ssl youractualdomain.com – LE will check for the TXT records against your domain, and if you’ve pasted it all correctly, your certificates will now be installed.

1 Like

This is the fun part. Since we’re using a wildcard certificate and our real domain name but keeping the A records pointed at the shared hosting for now, we’ll edit our local hosts file to tell our computer to go to our EE server when we visit youractualdomain.com and not the current server the site is sitting on.

I will assume you are on Windows. Open Notepad as Administrator. You want to head to C:\Windows\System32\drivers\etc\hosts

Add a line at the bottom, with the IP address of your EE server, and beside it your domain. Save the file. Open cmd and flush your DNS cache by typing in ipconfig /flushdns. Also clear your browser cache and restart your browser. If you’re not on Windows the steps are basically just as easy for OS X, just Google how to edit hosts file on OS X.

Now when you visit youractualdomain.com you will be taken to your EE server, with HTTPS/SSL working, even though every one else will continue seeing your old website because your A records are pointing to your shared hosting.

Final Steps:

You’ll need to increase your PHP upload limit. You need to do this in the custom.ini file, not php.ini, that’s why your changes weren’t taking effect. I’ll also include an extra config for you to tell nginx to cache your css and js files for longer, because by default it only caches for 1 day. This is optional for you to do, but just so you know how to do it.

To increase PHP upload limit: sudo nano /opt/easyengine/sites/youractualdomain.com/config/php/php/conf.d/custom.ini

; Custom PHP settings

upload_max_filesize = 256M
post_max_size = 256M

I used 256 as an example, set to whatever you need. Ps if you want to increase the max amount of RAM PHP can use for this website, the config is memory_limit = 256M. Save your changes (Ctrl+X then y then enter). Now sudo ee site restart youractualdomain.com

Finally, let’s tell nginx that our visitors’ browsers should cache our css and js files for longer than 1 day. Since these files are almost always static, meaning we don’t make changes to them often, they should be cached for a longer period of time: sudo nano /opt/easyengine/sites/youractualdomain.com/config/nginx/conf.d/main.conf.

Scroll all the way to the bottom, you’ll see a few lines that say the below. Add a # at the beginning of each of these lines to comment it out then save your changes. We don’t want to edit the nginx config directly in main.conf, otherwise it will be overwritten each time you upgrade EE to a newer version. Instead we will put it into the custom config file, so the changes remain persistent across upgrades (the same principle applies to the changes to your PHP custom.ini, they will remain persistent across EE version upgrades.)

        location ~*  \.(css|js)$ {
                expires 1d;
                add_header Cache-Control "public, must-revalidate";
        }

Now, sudo nano /opt/easyengine/sites/youractualdomain.com/config/nginx/custom/user.conf

Paste the above lines into the user.conf file (don’t put a # at the beginning of each line.) Notice where it says expires 1d, you can change this to 30d to have your files cached for 30 days, or 60 or 90 or however long you like. The longest you can go is changing it to expires max; – Now again save the file and sudo ee site restart youractualdomain.com

Visit your domain again, you’ll notice you’re not seeing your shared hosting website, you are seeing a freshly installed WordPress running on your EE server. But if you visit your domain from your phone, you’ll go to the shared hosting site. Neat huh? Log in, install UpdraftPlus again, and head to the Updraftpage and click on upload backup files. Drag and drop every file from the EE Migration Backup folder on your computer. Restore the backup. Once it finishes restoring, it will log you out. Simply log in again and Install and activate this plugin to remove query strings from your CSS and JS files. You know the ver?1.x.x. you see in the URL of your css/js files? these files won’t be cached unless you remove the query strings from them. Simple install and activate, no settings or anything. Now activate the WP Redis and the nginx-helper plugins.

Make all the changes and updates you need to the website, double check the website is A-OK. Once you are ready to make the website live, then at this point you can set the A records to the IP address of your EE server and you can delete the line that we created in your hosts file on your windows machine.

Ps you can create other websites on the server, they will not clash with each other. EE4 uses Docker to create separate container instances for each website you create. But, the PHP and nginx configs are not global, meaning if you want to increase the cache time in nginx or the upload limit for PHP you will need to follow the same steps to edit the custom ini files for each site that you create.

If your current website on your shared hosting does not use HTTPS/SSL: skip the --ssl=le --wildcard flags when you create your website and skip the SSL verification process.

Once you’ve finished everything, now you can add SSL and complete verification. sudo ee site update youractualdomain.com --ssl=le --wildcard – add the 2 TXT record validation keys for _acme-challenge.youractualdomain.com it’s given you to the DNS records for your domain, then sudo ee site ssl youractualdomain.com to complete verification and download the certificates. Restart the site sudo ee site restart youractualdomain.com and now you’ve got SSL.