Easily Deploy a Short Link Website with Myurls
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
Create a directory:
mkdir myurls && cd myurls/
Download docker-compose.yml:
wget https://raw.githubusercontent.com/stilleshan/dockerfiles/main/myurls/docker-compose.yml
Modify its contents:
nano docker-compose.yml
Change
MYURLS_DOMAIN
to your domain
ChangeMYURLS_TTL
to the short link expiration time (unit: days)
Change the left part ofports:- "8002:8002"
to an unoccupied portSave and exit:
Use Ctrl+X/Command+XStep 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 addressRelated Links:
GitHub Address: https://github.com/stilleshan/dockerfiles/tree/main/myurls
Demo: https://s.ops.ci
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)