Skip to content

whereistom/Tompressor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

#################################################################################
# Tompressor, is a simple Python URL compressor that you can deploy on Apache   #
#################################################################################


Author: tom 'at' tomjournal 'dot' net
Year: 2012

This software comes with no assurance and may destroy your computer and electronic equipment.
I am not responsible for any damage created by this software.

Follow those instructions to make it work:


Install Apache2 and create a SQLite database. Firefox has an extension to manage SQLite database which will help you in this task.
Visit Firefox website to get the SQLite manager.

This release contains an HTML index file and a little favicon icon which you can change to personalize your service.

The cgi-bin folder contains the Python code that will make the magic happen.

To run this software you need to configure Apache 2 properly! I've included a sample configuration to rewrite the URLs. Be sure that
the rewrite module of Apache is ENABLED!

In the /etc/...whatever.../site-enable  folder; edit the configuration file as follow:

## THIS CODE MUST BE IN YOUR APACHE CONFIGURATION TO MAKE THE URL COMPRESSOR WORK ###

<VirtualHost *:80>
	ServerAdmin my@email.com

	DocumentRoot /var/www
	<Directory "/var/www/">
	    Order allow,deny
	    AllowOverride None
	    Options +Indexes +FollowSymLinks
	    Allow from all
	    RewriteEngine On
            RewriteBase /
            RewriteCond %{REQUEST_FILENAME} !-f
            RewriteCond %{REQUEST_FILENAME} !-d
            RewriteRule ^(.*)$ /cgi-bin/query.py?shorturl=$1 [L,QSA]
	</Directory>
	<Directory "/var/www/cgi-bin/">
	    AddHandler cgi-script .cgi .py
	    AllowOverride None
	    Options +Indexes +FollowSymLinks +ExecCGI
	    Order allow,deny
	    Allow from all
	</Directory>
## This will allow to rewrite redirect any request to the webserver to right webpage ##


########################
# SQLite configuration #
########################

To make it work without any changes you have to create a SQLite DB.

The structure of the database is:

Name |   Type  |   null   |  key  |
--------------------------------------
id   | INTEGER | not null | primary key
url  | TEXT
hash | TEXT


Use Firefox SQLite Manager to configure the DB easily 







EOF

About

A simple Python URL compressor. You need Apache and SQLite to make it work ;-)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages