And now, introducing something I made during lunch.
SimpleShortener is a simple redis backed nginx url shortener.
It was inspired by https://github.com/MendelGusmao/nginx-redis-url-shortener and http://uberblo.gs/2011/06/high-performance-url-shortening-with-redis-backed-nginx.
It is intended to be used as a standalone service. The idea being that you'll be hosting it on a short domain like http://go.to, and redirecting to a longer domain like http://example.com.
This isn't to say you can't use under a single domain, it just wasn't created with that in mind.
If you find this software useful. I'd love to hear from you, drop me a line at [email protected] and let me know your thoughts.
It's simple. It should be fast. It should scale well. (I haven't benchmarked it)
Or instead of openresty:
- Extract the zip somewhere.
- Modify the first line of
nginx.conf
to use the account you want. For example:user www staff;
nginx -p /path/to/simpleshortener
Pass your URL as the parameter "url" to /shorten, for example:
http://localhost/shorten?url=http://somelongdomain.com/somelongpath/somelongfilename.somelongextension
And out pops the short url:
http://localhost/28lK
Note that you can change the number of characters in the URL changing the number of 9 in line 60 of pack.lua.
Open the short url in your browser. Ta da!