NGINX: Essential Guide to This Powerful Web Server

Deploying a Flask Weather App via NGINX with HTTPS on GCP
In this blog post, we’ll walk through how to deploy a Flask-based weather application using Docker, NGINX, and a secure HTTPS connection via Certbot on a GCP Virtual Machine (VM).
We’ll be using a public Docker image:
👉 sourabhaswal98/flask-weather-app
and the GitHub repo:
👉 SourabhAswal/flask-weather-app
Let’s break it down step-by-step. 💡
✅ Step 1: Create a VM Instance in GCP with a Static IP
Go to your GCP Console.
Navigate to Compute Engine > VM instances.
Click "Create Instance" and configure:
Choose a region and zone.
Select a suitable machine type (e.g.,
e2-microfor demo).Under Firewall, check Allow HTTP and HTTPS traffic.
In the Networking > Network interfaces, reserve a static external IP.
Example:
yamlCopyEditVM Name: climate
Static IP: 34.42.134.45 (example)
✅ Step 2: Install Docker & Run the Weather App
Install Docker:
sudo apt update
sudo apt install docker.io -y
sudo systemctl start docker
sudo systemctl enable docker
Pull and run the Docker image:
udo docker pull sourabhaswal98/flask-weather-app
sudo docker run -d -p 3000:3000 sourabhaswal98/flask-weather-app
The app is now running at
http://<your-static-ip>:3000
✅ Step 3: Point Your Domain to the Static IP
We’ll now point our custom domain (climateapp.skilla.ai) to the static IP.
Go to your DNS provider (e.g., GoDaddy, Namecheap, Cloudflare).
Add an A record like this:
| Type | Name | Value (Static IP) |
| A | climateapp.skilla.ai | 34.123.45.67 |
Wait for the DNS propagation to complete (usually a few minutes).

✅ Step 4: Install and Configure NGINX
Back on your VM, install NGINX:
sudo apt install nginx -y
Paste the following config:
/etc/nginx/nginx.conf
server {
listen 80;
server_name climateapp.skilla.ai;
location / {
proxy_pass http://localhost:3000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
Enable the config:
sudo nginx -t
sudo systemctl restart nginx
Now your app is accessible at:
http://climateapp.skilla.ai

✅ Step 5: Secure It with HTTPS (Let’s Encrypt + Certbot)
Now that your app is live, it’s time to secure it.
Install Certbot:
sudo apt install certbot python3-certbot-nginx -y
Run Certbot to configure SSL:
sudo certbot --nginx -d climateapp.skilla.ai
Follow the prompts to complete the SSL setup. Once done, Certbot will automatically:
Update your NGINX config with SSL directives.
Obtain and install an SSL certificate.
Reload NGINX.

Now your app is live at:
🔒 https://climateapp.skilla.ai

🎉 That’s It!
You've successfully:
Created a GCP VM with a static IP
Deployed a Dockerized Flask weather app
Configured NGINX as a reverse proxy
Set up a custom domain
Secured your site with HTTPS via Certbot




