Setting up SSL certificate on google cloud apache

google-cloud-platform

I am trying to get my VM instance apache installation to be accessible via SSL.

I have a google VM instance "lamp deployed-from-google-developer-console"

This "Allows HTTP traffic" and "Allows HTTPS traffic" I have checked this under Network Firewall rules:

default-allow-http  0.0.0.0/0   tcp:80  http-server
default-allow-https 0.0.0.0/0   tcp:443 https-server

I have SSL enabled, configured and the certificate installed.

If I test this locally (i.e. SSH onto the server) with

wget --no-check-certificate https://104.155.16.158

it connects and gives me the content fine. If I run the same command remotely the connection simply times out or gives a "Unknown SSL protocol error".

I also get the same behaviour when visiting the link in a remote browser, timeout.

No errors are showing in apache error log or ssl log.

It would appear I can connect via 443 on the main instance IP, but not on any of the ones set up in Network > IP addresses. These all happily connect via port 80.

Best Answer

When the forwarding rules were created for the sites they were only created on port 80, they needed to be created on port 80 and 443 e.g.

gcloud compute forwarding-rules create MY_RULE --target-instance MY_INSTANCE --ip-protocol TCP --port-range 80-443