ShortURL is a open source URL shortening service (a.k.a URL redirection) allowing anyone to take any existing URL and shorten it.
✨ Demo: https://short.u2b.eu
Name | Type | Details |
---|---|---|
SqlConnection | string | The connection string of the database |
origin | string | The origin of the web ui, usually is just the URL of the web. If you set this uncorrectly, you may meet CORS error. |
homePage | string | The URL of the web, if one short url is missing, the user will be redirected here. |
prefix | string | The prefix of each short url. |
Here're the config running on https://short.u2b.eu:
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
}
},
"AllowedHosts": "*",
"ConnectionStrings": {
"SqlConnection": "server=localhost;port=3306;database=shortUrl;uid=shorturl;pwd=<pwd>;CharSet=utf8"
},
"SiteSettings": {
"origin": "https://short.u2b.eu",
"homePage": "https://short.u2b.eu",
"prefix": "https://u2b.eu"
},
"Kestrel": {
"EndPoints": {
"Http": {
"Url": "http://0.0.0.0:5000"
}
}
}
}
- Import the
init.sql
into your Mysql/Mariadb - Run the container
docker run -d -e ConnectionStrings__SqlConnection="server=<ip to the db>;port=<db port>;database=shortUrl;uid=shorturl;pwd=<pwd>;CharSet=utf8" \
-e SiteSettings__origin="https://short.u2b.eu" \
-e SiteSettings__homePage="https://short.u2b.eu" \
-e SiteSettings__prefix="https://u2b.eu" \
-p 5000:5000 \
--name url_shorter \
--restart=always \
url_shorter
- Import the
init.sql
into your Mysql/Mariadb - Edit your database config in
appsettings.json
, then run:
dotnet build
dotnet run
👤 Gaojianli
- Website: https://blog.gaojianli.me
- Github: @Gaojianli
Give a ⭐️ if this project helped you!
Copyright © 2020 Gaojianli.
This project is MIT licensed.
This README was generated with ❤️ by readme-md-generator