Configuring Custom Domain for Harbor on Linode: A Technical Guide

Technical Setup of Harbor Custom Domain on Linode

A technical walkthrough on setting up a custom domain for Harbor on Linode, including Nginx configurations and SSL certification via Certbot.

10th Apr 2024


Deploying Harbor through Linode's marketplace is straightforward until you encounter the domain configuration. Linode's default domain service doesn't cover custom domain setup for Harbor, a gap this guide aims to fill.

Initial SSH Access

Start by securing SSH access to your Linode instance. This can be achieved via a local terminal or through Linode's Lish console. Navigate to the Nginx configuration directory at /etc/nginx/sites-available.

Nginx Configuration File

Within the sites-available directory, create a new configuration file for your domain, e.g.,, with the following content:

server {
   error_log /var/log/nginx/;
   access_log /var/log/nginx/;

   location / {
      proxy_pass http://localhost:8000;
      proxy_http_version 1.1;
      proxy_set_header Upgrade $http_upgrade;
      proxy_set_header Connection "upgrade";
      proxy_set_header Host $host;
      proxy_set_header X-Forwarded-Proto $scheme; # Ensures proper forwarding to Harbor's Docker container

This configuration sets the groundwork for HTTPS activation with Certbot, particularly noting the inclusion of proxy_set_header X-Forwarded-Proto $scheme;, which is absent in the default setup and crucial for proper request forwarding.

SSL Certification with Certbot

Execute certbot for SSL certification, selecting during the process. Follow the on-screen instructions to complete the setup.

Updating Nginx's nginx.conf

Modify /etc/nginx/nginx.conf by inserting client_max_body_size 10G; within the primary http block. This adjustment caters to larger Docker image layers, customizable based on your requirements.

http {
   client_max_body_size 10G;

Harbor Configuration Adjustments

Alter /root/harbor/harbor.yml to update the hostname to and set external_url to This change ensures correct URL formatting, eliminating the default port inclusion.

Finalizing with Docker Compose

With configurations in place, decompose the current Harbor setup with sudo docker-compose down -v. Prepare the environment with sudo ./prepare or sudo ./prepare --with-trivy for Trivy integration. Finally, deploy the services with sudo docker-compose up -d.