Introduction:

Myurls is an open-source short link project, implemented with Go 1.20 and Redis, and easy to deploy.

Preview:

Deployment Method:

Step One: Update Sources

Ubuntu/Debian:

apt update -y && apt upgrade -y    

Centos:

yum update -y && yum upgrade -y   

Step Two: Install and Configure Docker

Install Docker:

curl -fsSL https://get.docker.com -o get-docker.sh && sudo sh ./get-docker.sh

Start Docker:

sudo systemctl start docker

Set Docker to Start Automatically at Boot:

sudo systemctl enable docker

Step Three: Install Docker Compose

sudo curl -L "https://github.com/docker/compose/releases/download/v2.20.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose

Step Four: Download docker-compose.yml

  1. Create a directory:

    mkdir myurls && cd myurls/
  2. Download docker-compose.yml:

    wget https://raw.githubusercontent.com/stilleshan/dockerfiles/main/myurls/docker-compose.yml
  3. Modify its contents:

    nano docker-compose.yml

    Change MYURLS_DOMAIN to your domain
    Change MYURLS_TTL to the short link expiration time (unit: days)
    Change the left part of ports:- "8002:8002" to an unoccupied port

  4. Save and exit:
    Use Ctrl+X/Command+X

    Step Five: Install and Run the myurls Container

    docker-compose up -d

    After deployment, you can access "myurls" at http://<your-ip>:8002 (modify the port number to the one you entered)

    Step Six: Reverse Proxy to Domain

    Here, a very simple method is used: Origin Rules provided by Cloudflare
    Configuration is as follows:

    Change Field to Hostname, Value to the full domain selected, Rewrite to the port filled in earlier

    Remember to resolve your subdomain to the server IP:
    Use an A record, Name as domain prefix, Content as server address

    Related Links:

    GitHub Address: https://github.com/stilleshan/dockerfiles/tree/main/myurls
    Demo: https://s.ops.ci

Tag:Configure, URL Shortening Platform, Myurls

Original link:http://enblog.fuyiran.link/Technology/26.html

Copyright: All posts on this blog, unless otherwise stated, are published using theCC BY-NC-SA 4.0 license agreement. Please indicate the source for reprinting Fu Speaking (enblog.fuyiran.link)

Add a new comment.