I created a Wordpress website on my GCP instance and it was assigned an external IP address automatically. I also have a static IP reserved for myself and I've assigned it to the instance.
I used to be able to connect to it initially and imported my previous website using the web browser and everything worked beautifully. However, now I cannot reach it any more over a web browser.
I ran a few commands to verify that there is a server listening on port 80:
root@xxxxxyyyzzzz-vm:~# netstat -tnlp | grep 80
tcp6 0 0 :::80 :::* LISTEN 1618/apache2
Also, SSH console opens and apache and MySQL processes are running:
root@xxxxxyyyzzzz-vm:~# ps -ef | grep apache
www-data 1618 15964 0 12:12 ? 00:00:00 /usr/sbin/apache2 -k start
www-data 1619 15964 0 12:12 ? 00:00:00 /usr/sbin/apache2 -k start
root 9108 8962 0 20:24 pts/0 00:00:00 grep apache
root 15964 1 0 Aug30 ? 00:00:14 /usr/sbin/apache2 -k start
www-data 28362 15964 0 06:25 ? 00:00:00 /usr/sbin/apache2 -k start
www-data 28363 15964 0 06:25 ? 00:00:00 /usr/sbin/apache2 -k start
www-data 28364 15964 0 06:25 ? 00:00:00 /usr/sbin/apache2 -k start
www-data 28365 15964 0 06:25 ? 00:00:00 /usr/sbin/apache2 -k start
www-data 28366 15964 0 06:25 ? 00:00:00 /usr/sbin/apache2 -k start
www-data 28797 15964 0 06:46 ? 00:00:00 /usr/sbin/apache2 -k start
root@xxxxxyyyzzzz-vm:~# ps -ef | grep mysql
root 9122 8962 0 20:24 pts/0 00:00:00 grep mysql
mysql 16015 1 0 Aug30 ? 00:02:29 /usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid
Also, my firewall rules are open on both ports 80 and 443.
Why can't I connect to the instance over my browser?
Ok, so in my case I found a hacky way to solve this. Just created a duplicate VM instance, and reserved its ephemeral IP to static, and deleted the old instance.
Not a clean solution but better than remaining stuck forever :\