Select the desired Machine type, such as "micro" (f1-micro).
Change the Boot disk to "CoreOS stable".
Check the boxes to allow HTTP and HTTPS traffic in the Firewall section.
Expand the Management, disk, networking section.
Click the Networking tab.
Select New static IP address under External IP.
Give the IP address a name, such as "reverse-proxy".
Click the Create button to create the Compute Engine instance.
Set up some domains for your instance
Create multiple A type DNS records for various domains/subdomains on your DNS provider pointing at the external IP address for your new instance.
For example, in Google Domains, open DNS for your domain, scroll to Custom resource records and add an A type record. The name "@" corresponds to the root of your domain or you can change it to a subdomain, such as "a" and "b".
This tutorial assumes that you have two subdomains with A records:
Setting up the reverse proxy
To have the separate websites respond only to their respective hosts, you use a reverse proxy. This tutorial uses the nginx-proxy Docker container to automatically configure NGINX to forward requests to the corresponding website.
As an example, this tutorial shows a plain NGINX server running as site A and a plain Apache server running as site B.
Run the docker-compose up -d command to run your composed containers with the new configuration.
When your Compute Engine instance restarts, the Docker containers will not automatically restart. Use the --restart flag for the docker run command to specify a Docker restart policy. I suggest always or unless-stopped so that Docker restarts the containers on reboot.
Running many web apps on a single host behind a reverse proxy is an efficient way to run hobby applications. To make your experience even better,
[Set up the Google Cloud logging driver for Docker to upload your containers'