Recommendations for a self-hosted URL shortener?
Hi Everyone,
I've used tinyurl.com
a number of times before, and of course there are well-known competitors such as bitly.com
, but recently, I've thought about trying to self-host a URL shortener, mainly intended for private use (for a group of users), and not intended as a public URL shortener for everyone to use (though this may be an interesting experiment to try out sometime).
Do any of you have experience with self-hosting a URL shortener?
My need is basically the following: given a link such as
http://mydomain.org/pub/documents/a-pdf-file-with-a-rather-long-name.pdf
,
shorten this to something like
http://mydomain.org/123cba
.
Naturally, the domain name itself (here: mydomain.org
) couldn't be shortened in this case (unless I got a new domain name!).
I'm looking at YOURLS (https://yourls.org/
), which is PHP-based and appears to be well-maintained. It needs a MySQL database, but some kind of database would be needed anyway.
Do any of you have other recommendations? (Needless to say, I'd like to keep it as simple as possible.)
"A single swap file or partition may be up to 128 MB in size. [...] [I]f you need 256 MB of swap, you can create two 128-MB swap partitions." (M. Welsh & L. Kaufman, Running Linux, 2e, 1996, p. 49)
Comments
I would recommend Yourls. It would work well. Just make sure to monitor it like a hawk. I ran a instance for a week with a Captcha and about 50% of my links were for used for spamming, so I would not recommend leaving it open to the public.
Cheap dedis are my drug, and I'm too far gone to turn back.
+! for yourls,
there are some SAAS alternatives with generous free/ base tier ($5/month) plans.
Would recommend getting a cheap shared hosting (the ultra cheap plan from @Smallweb is a good option) and host it there. Makes the management much easier. I host at Myw.pt, DE @MikePT
blog | exploring visually |
Yes, on this particular server, it would be offered as a private service, so I would need to protect it sufficiently.
If I tried to offer a public service, it would be on another server.
"A single swap file or partition may be up to 128 MB in size. [...] [I]f you need 256 MB of swap, you can create two 128-MB swap partitions." (M. Welsh & L. Kaufman, Running Linux, 2e, 1996, p. 49)
also take a look at:
https://github.com/thedevs-network/kutt
blog | exploring visually |
You're right that this would be a good use for cheap shared hosting. (I have shared hosting with @SmallWeb that I play around with.)
At the moment, the server in question (a VPS) is already up and running, and I'd like to use the server's domain name as the base of the URL.
"A single swap file or partition may be up to 128 MB in size. [...] [I]f you need 256 MB of swap, you can create two 128-MB swap partitions." (M. Welsh & L. Kaufman, Running Linux, 2e, 1996, p. 49)
Not self-hosted, but Rebrandly has a generous free tier. My wife is a light user and she has been happy using it. They offer browser plugins and even an app. So very user friendly particularly for non-tech users.
This looks nice and may be more of an "enterprise solution" than YOURLS is, but It may be overkill for my needs on this server. Also, I noticed:
"A single swap file or partition may be up to 128 MB in size. [...] [I]f you need 256 MB of swap, you can create two 128-MB swap partitions." (M. Welsh & L. Kaufman, Running Linux, 2e, 1996, p. 49)
Intriguing. I don't think that I was really familiar with the notion "branded link" before.
"A single swap file or partition may be up to 128 MB in size. [...] [I]f you need 256 MB of swap, you can create two 128-MB swap partitions." (M. Welsh & L. Kaufman, Running Linux, 2e, 1996, p. 49)
If the URL shortener could have a separate (sub)domain, you can achieve that with GitHub Actions.
https://dev.to/tusharsadhwani/how-i-made-my-own-url-shortener-for-free-293p
It's semi self-hosted because you control the git repository and can take it out at any time.
Accepting submissions for IPv6 less than /64 Hall of Incompetence.
That's a clever solution that makes good (and unexpected) use of a GitHub account. If I may say so, the author appears to be mainly addressing an audience that would prefer not to pay for a domain or for a hosting service, and accordingly, his solution uses both a free (.tk) domain and a free GitHub account. Nevertheless, it's a clever solution.
In my case, there's already a server up and running, so it makes sense for me to try to use this server for the URL shortener.
"A single swap file or partition may be up to 128 MB in size. [...] [I]f you need 256 MB of swap, you can create two 128-MB swap partitions." (M. Welsh & L. Kaufman, Running Linux, 2e, 1996, p. 49)
Sorry to hijack but I wonder how responsible you can be for redirected URL's if you yourself only offer the redirection service.
I also wonder what mitigation could be used e.g. free tier the link is only live for 250 clicks making is pointless for spamzors to use
https://inceptionhosting.com
Please do not use the PM system here for Inception Hosting support issues.
Sorry -- which comment are you referring to?
"A single swap file or partition may be up to 128 MB in size. [...] [I]f you need 256 MB of swap, you can create two 128-MB swap partitions." (M. Welsh & L. Kaufman, Running Linux, 2e, 1996, p. 49)
that one.
https://inceptionhosting.com
Please do not use the PM system here for Inception Hosting support issues.
Okay, I see: you're asking about how one would make the service less attractive to spammers.
This is a good question, and I haven't yet thought much about it, but in my particular use case (for a small group of users on a server that I manage), I don't envision having a publicly accessible page at all, so I hope to avoid the spam problem completely. But I have yet to install a URL shortener, so I'll have to see how this works in practice!
"A single swap file or partition may be up to 128 MB in size. [...] [I]f you need 256 MB of swap, you can create two 128-MB swap partitions." (M. Welsh & L. Kaufman, Running Linux, 2e, 1996, p. 49)
If you know how to program, then my recommendation is to do it yourself. That's what I did and it works fine. Opening it to public is not recommended, specially with google or any popular captcha as they can be bypassed with special scripts.
That is a very good premade script.
Your domain will get flagged for linking to scam sites, malware, child porn and so on... Linking to warez is the best possible outcome.
As long as you protect the url generation with password or keyphrase or something only your small group of users knows, it'll work out fine.
Websites have ads, I have ad-blocker.
@somik I guess so, I suppose it’s the same as tor in that regard, you setup a relay or exit, you probably facilitate peados, moral dilemmas.
https://inceptionhosting.com
Please do not use the PM system here for Inception Hosting support issues.
Which is why I coded my own url shortener and combined it with domain block list. That way I can at-least avoid redirecting to most known domains. It also sends me a message over telegram when someone generates a link so I can check if something shady is going on.
Your idea of limiting the number of visits to a single link is very good though, however they can simply generate multiple times to circumvent that...
Websites have ads, I have ad-blocker.
Someone is going to generate a link to a virus page and infest you when you visit the page to check.
Accepting submissions for IPv6 less than /64 Hall of Incompetence.
Given my domain blocklist for shorturl service, it is not very likely. Moreover, my phone browser is protected with uBlock Origin and the phone itself is connected to a always on DNS blocking VPN. But, shit happens. All I can do is wipe the phone when it happens it and move on.
Websites have ads, I have ad-blocker.
I'm watching this thread.
The thing is... Once I set it up, I want the URLs to live forever. That's.... Quite a long term commitment
Right, that's the forever-problem, which is basically unsolvable.
To tell the truth, I'm still a bit on the fence with respect to URL shorteners: for me, it's not so much a question of how to solve the forever-problem (which I can't solve), but even something like a 10-year commitment may be challenging. People change, priorities change, jobs change, servers change.
In my use case, it would be shortened links of longer links to documents on a particular server, so the idea is that as long as that server is around, the shortened links should work, but if the server is no longer around, then none of the links (even the longer links) would work.
I find the idea of self-hosting a private URL shortener attractive, but at the same time, I'm not rushing into it.
It's also the case that the "long links" on this server aren't so long by some measures: they're not longer than a normal line of text, so this may not be so bad after all.
"A single swap file or partition may be up to 128 MB in size. [...] [I]f you need 256 MB of swap, you can create two 128-MB swap partitions." (M. Welsh & L. Kaufman, Running Linux, 2e, 1996, p. 49)
Yes, domain part is surely tricky ( maybe a multi year deal, this coming BF maybe ? ) but surely @MikePT can help with web space ( Best effort ),
Mini Shared Hosting, 2 GB SSD, LA or DE, 9.99€ LIFETIME - In stock
https://talk.lowendspirit.com/discussion/1622/pay-only-once-for-your-da-based-shared-9-99-lifetime-and-reseller-hosting-80-lifetime-la-or-de
This is a pretty basic stack, it's the minimum barebones equivalent of node|python|whatever/postgres = php/mysql
https://polrproject.org/ is very good, or if you want to host it on shared web hosting you can use my friend's one: https://github.com/IbraaMx/Linktree-clone
AmirGT | AS207740
Hmm, never considered the 10 year problem, makes me wonder how much use a 30 day URL would be as a service.
https://inceptionhosting.com
Please do not use the PM system here for Inception Hosting support issues.
Hello,
I wrote a Self hosted URL shortener a little while back and I’ve not done anything with it. It’s not currently hosted at the moment but I would be willing to pass it on to someone else, and set it up for you if we could come to a deal?
github it?
“Technology is best when it brings people together.” – Matt Mullenweg
I’d be happy to open the project, it’s currently private. I’d need to document the setup process etc and it’s not the most straight forward to host. Ideally you need multiple servers and MySQL replication setup as master -> slave. It’s not 100% necessary but I built it to scale as I planned on doing something with it.
Assuming that you're addressing me, I was rather looking for a free-software solution that I could install myself. This said, your product looks nice (but may be overkill for my needs).
"A single swap file or partition may be up to 128 MB in size. [...] [I]f you need 256 MB of swap, you can create two 128-MB swap partitions." (M. Welsh & L. Kaufman, Running Linux, 2e, 1996, p. 49)
I glanced at this software, but it hasn't been updated since May 2017, and so I wasn't sure whether it was an abandoned project or just super stable.
Frankly, I'm not sure what this project is, which was uploaded only yesterday.
"A single swap file or partition may be up to 128 MB in size. [...] [I]f you need 256 MB of swap, you can create two 128-MB swap partitions." (M. Welsh & L. Kaufman, Running Linux, 2e, 1996, p. 49)