Skip to content

Latest commit

 

History

History
57 lines (33 loc) · 1.97 KB

README.md

File metadata and controls

57 lines (33 loc) · 1.97 KB

SimpleShortener

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.

So, what's good about it?

It's simple. It should be fast. It should scale well. (I haven't benchmarked it)

Requirements

Or instead of openresty:

Getting Started

Installation

  1. Extract the zip somewhere.
  2. Modify the first line of nginx.conf to use the account you want. For example: user www staff;

Starting the server

nginx -p /path/to/simpleshortener

Shortening a URL

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.

Expanding a URL

Open the short url in your browser. Ta da!