Fixing WordPress When Changing DNS

I ran into an issue with WordPress yesterday when I reset my router. In short, the reset changed my IP Address. I updated the pointers for my domains and all started working again – except for my WP sites, which I access by IP Address rather than domain name.

Basically, the first page’s content would download, but then the server would start looking for things at the old IP Address. Since it couldn’t make contact, loading eventually timed out.

It turns out that WP stores the domain name (even if it’s just an IP address) in the database and uses this as the default root when loading up files and modules.

The solution is to update the site’s option_value field for the first 2 rows (‘siteurl’, ‘home’) in the wp_options table with the new IP Address.

Rebooting the MSA servers on DigitalOcean

I ran into some problems rebooting the MSA servers. Turns out, Apache starts to boot up but gets stalled when the server asks for the SSL certificate. In theory, this should happen automatically but I just could not get it to work.

To get past this problem, I did the following:

Step 1: via SSH, run sudo shutdown -h now (or sudo poweroff) (shuts down the entire server)

Step 2: on the DigitalOcean control panel, click “powercycle” (restarts the server)

Step 3: via SSH, run sudo netstat -antp | grep 80 (lists the PIDS that are currently listening on port 80)

Step 4: via SSH, run sudo kill -9 NNNN <<< replace NNNN with PID for ghost httpd listening on port 80 (kills the rouge PID to free up port 80)

Step 5: via SSH, run sudo service httpd start (restarts Apache)

Step 6: via SSH, provide the passkey for SSL certificate

That’s it!