I recently installed a Wordpress instance on Google's Compute Engine with Google's own one-click install button.

It doesn't let you configure the server or OS so I just took what Google offered (Debian 8 on a 1 vCPU + 3.75 GB memory (n1-standard-1) + 10-GB Boot Disk. It worked perfectly and I was up and running on an IP address: yy.yy.yy.yy in next to no time.

After 5 days Google Compute sent me an alert which suggested that I could save some money (on my free account) by resizing my server to 1.7 GB memory.

Happy to comply, I clicked ok and broke my website. Google had given me a new IP address: xx.xx.xx.xx. Pointing my browser at xx.xx.xx.xx gave me:

This site can’t be reached

xx.xx.xx.xx refused to connect.

I tried both https://xx.xx.xx.xx and http://xx.xx.xx.xx and got the same message

Running Lynx on the server gives me the following log:

Looking up  'xx.xx.xx.xx' first
Looking up xx.xx.xx.xx first
Looking up xx.xx.xx.xx
Making HTTP connection to xx.xx.xx.xx
Sending HTTP request.
HTTP request sent; waiting for response.
HTTP/1.0 301 Moved Permanently
Data transfer complete
HTTP/1.0 301 Moved Permanently
Using http://yy.yy.yy.yy/
Looking up yy.yy.yy.yy
Making HTTP connection to yy.yy.yy.yy
Alert!: Unable to connect to remote host.
lynx: Can't access startfile http://xx.xx.xx.xx/

Where yy.yy.yy.yy is the original IP address (before the resize).

It seems that the resize gave me a new IP address. However this now redirects to my old IP address (which no longer exists).

I have updated the siteurl in the wp_options table in the WP database to xx.xx.xx.xx (replacing the old ip address). Restarted apache2 The page is still redirecting to yy.yy.yy.yy ("This site can’t be reached").

I am not very used to reading Apache2 config files but, as far as I can see .htaccess doesn't have any redirects. I can't see anything in apache2.config (and associated files - but I might be missing something)

My Google Compute console doesn't have any unusual firewall rules or routes set up. I am wondering where I might find this redirect. Is it in my Apache2 server or something that Google run in the layer above my VM (my conceptual model of how Google Compute works isn't fully formed). How can I tell?

Advice and suggestions are very welcome and much appreciated. I don't know much about server side things but I am keen to learn.

  • I don't know Wordpress, but I am guessing that somewhere in the configuration you were asked for a domain name and instead put in the IP address. And you haven't gone back and updated that configuration after the IP address changed. You can change your current IP address from ephemeral to static to prevent it from changing again in the same way again. You can't get your previous IP address back, so you will have to find the configuration with the old IP address and change it. I recommend that you get a real domain name instead. There are other drawbacks from using IP addresses in URLs. – kasperd Jan 28 '18 at 1:43

The WordPress registers your external IP address during the original deployment and will only accept requests that resolve to that IP address regardless of the true server IP address.

This being said, you need to connect to your WordPress instance and update the database with the new external IP address. If you can access your admin page, you can update the "Wordpress Address (URL)" and "Site Address (URL)" fields. Otherwise, you will have to update the database directly. This post can walk you through making this change. There is no additional cost for static IP addresses on GCP as long as it is in use.

As @kasperd mentioned, you should promote your current ephemeral IP address to static to avoid this issue in the future.

  • Thanks @Patrick_W,I used myphpadmin >> wpdatabase >> wp_options to change the ip addresses you mentioned. Everything is working correctly now. Thank you. – payo Jan 29 '18 at 20:37

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.