Hey Devs 👋,

In this post, I’ll guide you through deploying OwnCloud on a GCP VM instance using Docker, secured with NGINX as a reverse proxy and HTTPS enabled via Let's Encrypt.


🧰 What You’ll Need

  • Google Cloud Platform (GCP) account
  • Basic Linux & Docker knowledge
  • Domain name (e.g., ceritadesain.com)
  • SSH access to your VM

📦 Step 1: Create a GCP VM Instance

  1. Go to Google Cloud Console
  2. Navigate to: Compute Engine > VM instances
  3. Create a new instance:
    • OS: Ubuntu 22.04 LTS
    • Firewall: Allow HTTP & HTTPS
  4. SSH into your instance once it’s running.

🐳 Step 2: Install Docker & Docker Compose

sudo apt update
sudo apt install docker.io docker-compose -y
sudo systemctl enable docker
sudo usermod -aG docker $USER

🔁 Logout and login again to apply Docker group permissions.


📁 Step 3: Setup OwnCloud with Docker Compose

Create a folder for the project:

mkdir owncloud-docker && cd owncloud-docker

Create a docker-compose.yml:

version: '3.1'

services:
  owncloud:
    image: owncloud/server
    restart: always
    ports:
      - 8080:8080
    environment:
      - OWNCLOUD_DOMAIN=ceritadesain.com
      - OWNCLOUD_ADMIN_USERNAME=admin
      - OWNCLOUD_ADMIN_PASSWORD=yourpassword
    volumes:
      - files:/mnt/data

volumes:
  files:

Run:

docker-compose up -d

You can now access it at http://your-external-ip:8080.


🌐 Step 4: Point Your Domain to the VM IP

On your domain provider, update the A record to point to your GCP VM's external IP.

Example:

A  @  ->  34.100.xxx.xxx

🔐 Step 5: Setup NGINX Reverse Proxy + SSL

Install NGINX and Certbot:

sudo apt install nginx certbot python3-certbot-nginx -y

Create an NGINX config:

sudo nano /etc/nginx/sites-available/owncloud

Paste this:

server {
    listen 80;
    server_name ceritadesain.com;

    location / {
        proxy_pass http://localhost:8080;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
    }
}

Enable it:

sudo ln -s /etc/nginx/sites-available/owncloud /etc/nginx/sites-enabled/
sudo nginx -t
sudo systemctl restart nginx

Add HTTPS via Certbot:

sudo certbot --nginx -d ceritadesain.com

Done! 🎉 Now your OwnCloud is accessible via https://ceritadesain.com


🧠 Bonus Tips

  • Use Docker volumes for persistent data.
  • Set up automatic SSL renewal with:
sudo crontab -e

Add:

0 0 * * * certbot renew --quiet

🤝 Let’s Connect!

If you found this helpful, feel free to comment or connect with me on LinkedIn or GitHub. I'm always up for feedback or collaboration on DevOps, web, and ML projects.