Before getting started: Make sure that APACHE or on-VM NGINX aren't installed. Google cloud sometimes comes with apache installed by default.
sudo systemctl stop apache2
sudo systemctl disable apache2
sudo apt remove --purge apache2 -y
sudo apt autoremove -y
- Git clone the repository
git clone https://github.com/geoace/certbot-nginx.git
cd certbot-nginx
- make startup executable
chmod +x start-nginx.sh
- Copy the env file
cp .env.template .env
- Modify the environment variables to suit your deployment
nano .env
docker compose up -d
-
Visit the IP address of your virtual machine UNSECURED using HTTP and ensure your home page exists (e.g., http://123.456.7.89)
-
Set up Domains between GCP and Registrar (Siteground is used in the video tutorial) ONCE DNS Zones and Nameservers are linked between GCP and Siteground/registrar, Run docker compose to get the certificates
-
Once you've verified that your site is up and running at the unsecured (HTTP) domain (i.e., http://yourdomain.com), then remove the containers and recreate them to receive your certificates
docker rm $(docker ps -aq) -f
docker compose up
- Exit the containers using Control + C, and then remove them (certificates have been received, but NGINX is still not running via SSL due to configuration file contents; certificates WILL persist)
docker rm $(docker ps -aq) -f
- Run the docker containers in the background for the "real world" setup
docker compose up -d
- Navigate to https://yourdomain.com to verify that you're running using SSL/HTTPS!