Skip to content

How to setup Linkwarden (with Docker & Caddy)

Untested

Description

Linkwarden is a self-hosted, open-source collaborative bookmark manager to collect, organize and archive webpages.

The objective is to organize useful webpages and articles you find across the web in one place, and since useful webpages can go away (see the inevitability of Link Rot), Linkwarden also saves a copy of each webpage as a Screenshot and PDF, ensuring accessibility even if the original content is no longer available.

Create a DNS record

Go to cPanel and add a new record (e.g. links.akdscloud.eu).

Caddy

links.akdscloud.eu:443 {
    header Strict-Transport-Security max-age=31536000;
    reverse_proxy localhost:3000
}

Files and Folders

cd ~/services
mkdir -p linkwarden/{data,db}
touch linkwarden/linkwarden.env

Docker

  1. Add the links section to your docker-compose.yml file:

      linkwarden:
        image: ghcr.io/linkwarden/linkwarden:latest
        container_name: linkwarden
        restart: unless-stopped
        env_file:
          - ./linkwarden.env
        ports:
          - "127.0.0.1:3000:3000"
        volumes:
          - ./linkwarden/data:/data/data
        depends_on:
          - linkwarden-db
          - caddy
    
      linkwarden-db:
        image: postgres:17-alpine
        container_name: linkwarden-db
        restart: unless-stopped
        env_file:
          - ./linkwarden.env
        volumes:
          - ./linkwarden/db:/var/lib/postgresql/data
        depends_on:
          - caddy
    

    Add this to linkwarden.env:

    # Database configuration
    POSTGRES_USER=linkwarden
    POSTGRES_PASSWORD=your_very_secure_password_here
    POSTGRES_DB=linkwarden
    
    # Linkwarden configuration
    NEXTAUTH_SECRET=your_random_secret_key_here
    NEXTAUTH_URL=https://links.akdscloud.eu
    DATABASE_URL=postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@linkwarden-db:5432/${POSTGRES_DB}
    NEXT_PUBLIC_DISABLE_REGISTRATION=true
    

    You can generate a secure random string for POSTGRES_PASSWORD and NEXTAUTH_SECRET with:

    openssl rand -hex 32
    

  2. Download and start links:

    docker compose up -d linkwarden
    
  3. Restart Caddy to get an SSL certificate (details here)

Try it out

See if you can access the links web interface.

Troubleshooting

If it doesn't work, see the troubleshooting guide.

Configuration

Admin account

Create an admin account from the web interface.

If you can't create an account,

  • comment NEXT_PUBLIC_DISABLE_REGISTRATION=true from the docker-compose.yml file
  • docker compose down linkwarden
  • docker compose up -d linkwarden
  • then try again (to create the admin account)

Official site

Github page