Migrating a WordPress site to Linode

Hello, I waited for the may Linode thing so I could migrate our organization’s WordPress website (I know, but it’s a non-profit organization, so rebuilding is not an option) from GoDaddy to Linode and save a ton of money, so thanks Linode and Level1Techs!

I managed to get the website up and running rather easily, but I found out that the wp-config was directing the DB to GoDaddy, and when I tried to change it to the new creds and location of the DB the website loads, but only texts and links no theme and no way to enter the WP-Admin.

Has anyone experienced something similar while migrating a WP website? i followed 2 plugins that migrate the whole website and a manual migration guide, no luck.

Thanks!

Have you copied over the database at all?

You have to backup that too and import it on the new Linode Server you got.

1 Like

yes, I imported it into the new DB, I followed the manual here:
https://sijobling.com/blog/moving-wordpress-to-linode/
no luck, plus if I try again it says it already exists, so it’s there.

Does it still work now when you change the dabase connection back to the old server?


You can look into the logs for something useful.

In /etc/apache2/sites-available you should have some ErrorLog path defined. Look into that file.

You can also enable wordpress debug logs in wodpress. Put those two into your wp-config.php define( 'WP_DEBUG', true ); and define( 'WP_DEBUG_LOG', true );. Hopefully some of this leads you into the right direction. That should spit out debug.log in the wp-content folder.

There is still the possibility of you having imported it under another name or something. Since you tried multiple guides. CREATE DATABASE is going to be one of the first lines in the sql dump. It does not check if the dabase contains what it´s supposed to. If it exists, but is completely empty. It will still tell you it exists and exit.

You can print out what databases exist with SHOW DATABASES; and delete one with DROP DATABASE <name> if you wanna try that again.

yes when the wp-config is connecting to the old db the site on linode works well.

i did show databases before there’s the new db that was created by linode, and one of the plugins merged the old one into (I checked its size) and there’s the old db with it’s old name there as well from the manual import.

i cannot drop one of the dbs that were imported manually even as the root user, and even after I checked that it has permissions over all the databases.

I don’t have an errorlog file there, or did I miss a step?

i will try that tomorrow and see if something pops up there, thanks for all the help so far!

The config for the page is in there. And you should have ErrorLog defined inside it with whatever path you set there.

i have a ton of these:

[Sun May 09 06:32:19.216587 2021] [php7:error] [pid 18107] [client 18.222.75.248:56618] PHP Fatal error: Uncaught Error: Call to undefined function get_header() in /var/www/wordpress$
[Sun May 09 06:43:10.681034 2021] [access_compat:error] [pid 21992] [client 75.119.215.210:38307] AH01797: client denied by server configuration: /var/www/wordpress/xmlrpc.php
[Sun May 09 06:57:56.295325 2021] [access_compat:error] [pid 18107] [client 208.97.136.31:48368] AH01797: client denied by server configuration: /var/www/wordpress/xmlrpc.php
[Sun May 09 07:15:02.529616 2021] [access_compat:error] [pid 21991] [client 144.91.74.140:54734] AH01797: client denied by server configuration: /var/www/wordpress/xmlrpc.php
[Sun May 09 07:35:08.137176 2021] [access_compat:error] [pid 17337] [client 62.210.111.85:5907] AH01797: client denied by server configuration: /var/www/wordpress/xmlrpc.php, referer:$
[Sun May 09 07:41:10.998717 2021] [access_compat:error] [pid 22499] [client 165.227.71.206:61978] AH01797: client denied by server configuration: /var/www/wordpress/xmlrpc.php
[Sun May 09 07:47:27.157936 2021] [access_compat:error] [pid 21998] [client 198.12.246.118:51976] AH01797: client denied by server configuration: /var/www/wordpress/xmlrpc.php
[Sun May 09 08:05:00.949217 2021] [access_compat:error] [pid 17359] [client 107.180.235.105:39148] AH01797: client denied by server configuration: /var/www/wordpress/xmlrpc.php
[Sun May 09 08:05:39.617098 2021] [access_compat:error] [pid 21992] [client 107.173.248.219:1670] AH01797: client denied by server configuration: /var/www/wordpress/xmlrpc.php, refere$
[Sun May 09 08:05:40.646823 2021] [access_compat:error] [pid 23419] [client 198.12.108.219:51807] AH01797: client denied by server configuration: /var/www/wordpress/xmlrpc.php, refere$
[Sun May 09 08:05:41.683400 2021] [access_compat:error] [pid 17337] [client 192.3.139.139:16185] AH01797: client denied by server configuration: /var/www/wordpress/xmlrpc.php, referer$
[Sun May 09 08:05:42.472018 2021] [access_compat:error] [pid 22339] [client 192.3.195.125:60125] AH01797: client denied by server configuration: /var/www/wordpress/xmlrpc.php, referer$
[Sun May 09 08:23:12.749354 2021] [access_compat:error] [pid 17337] [client 97.79.238.65:49196] AH01797: client denied by server configuration: /var/www/wordpress/xmlrpc.php

I think this is the cause:
[Sun May 09 06:32:19.216587 2021] [php7:error] [pid 18107] [client 18.222.75.248:56618] PHP Fatal error: Uncaught Error: Call to undefined function get_header() in /var/www/wordpress/wp-content/themes/jarida/index.php:1\nStack trace:\n#0 {main}\n thrown in /var/www/wordpress/wp-content/themes/jarida/index.php on line 1

Looks like you are running into a permissions issue. You need to create the same user that existed on GoDaddy that manages the WP site and your Apache/NGINX server and give it the proper permissions and add it to the correct groups.

I thought about that and did that as well, created the same username that shows up in the working wp-config, even gave it the same password, and gave it permissions to all databases.

didn’t work. I am talking about a SQL user and not an os user, I’m guessing that’s what you meant.

You need to do both, SQL user account and permissions to the WP tables and OS account with permissions to the WP directory and add it to the correct groups to modify the WP directory and interact with Apache/NGINX.

Are you sure about that? I have no other user aside from root, and the default website worked with just the user for MySQL.

EDIT: i just checked godaddy, and the sql doesn’t even run on the same server, i can’t access it via a MySQL command there.

I could be wrong. I hardened my system. Also, my web server host the different apache instances with different credentials and different MySQL instance.

Do you have any cross site scripting prevention plugins installed?

I think I solved the issue, someone on the Linode forum mentioned that I need to flush privileges after giving the MySQL user permissions for the database, so I changed the wp-config to localhost, and the site didn’t break.

now I’m trying to figure out if “define(‘AUTH_KEY’,” should stay the same as the old site, or can I update it to the new WordPress wp-config.

BTW, thanks for all the help, care to share any tips on securing that site as much as possible?
I do have wordfence which is awesome and cleaned the virus infection we had on the old site, but I was wondering something more along the lines of the OS level.

There is a good set of Linode articles that should guide you along the way whether you are using NGINX or Apache.

Also, @PhaseLockedLoop has been posting a series of Web Hosting and Housekeeping How-Tos that may help as well.

3 Likes

Thanks for the share!

1 Like

ok so far what I saw I already did most if not all of those suggestions, plus wordfence covers most of them, and I know for a fact it works well.

the rest of the guides are for Nginx, and I think the marketplace WordPress on Linode defaults to using apache.

so if those are all, I thank you and feel a bit more confident in my knowledge and the job I’ve done with this server.

No worries. I am using Apache as well as I am a little bit of a dinosaur with Web hosting so I stick to what I know. With that said, some of NGINX features have crept their way into Apache (in different forms) so some of the NGINX stuff may apply in concept depending on what you are doing.

Either way, happy computing and thanks for taking the time to implement security as a forethought instead of an after thought.

Yeah, when I started managing that website on GoDaddy, i had the enormous task of securing it after it had been infected, and it was a pain. we’re talking about a site from 2011 originally so there were tons of updates and cleaning to do, and wordfence is just awesome for that.

anyway thank you all for helping out, hope this thread help someone in the future.

2 Likes

You can go with managed WordPress hosting that offers multiple cloud platforms and apps, like Cloudways, which offers AWS, GCE, Vultr, Linode, and DO, You will have options to move or change any cloud provider anytime. Also, they offer multiple apps like Magento, WordPress, PHP, WooCommerce, you may switch the apps as well by using their clone feature. It’s the best choice I have ever made with my hosting decision.