Install YOURLS URL shortener on your own server

Requirements:
Shared server/VPS with the following installed:
A webserver with php installed
mysql

Set up YOURLS url shortening service on your domain.
I’ve added the domain to i-mscp to create a web hosting directory

ssh to the shell

cd /var/www/virtual/mysite.com/htdocs
rm -rf ./*
git clone https://github.com/YOURLS/YOURLS
mv YOURLS/* ./
rm -rf YOURLS
cp user/config-sample.php user/config.php

Login to phpmyadmin and create a new database named yourlsdb.
Under Privileges tab, create a new user, name it yoursusr
Generate a secure password like this: [email protected]&Cc^95gMY#6Bhd
Tick the box to Grant all privileges on ‘yourlsdb’ to yoursusr

Now edit the config file, and add database details:

emacs user/config.php

Visit http://yourls.org/cookie and generate a cookie key and update it in this same file.

Add appopriate passwords at this block:

$yourls_user_passwords = array(
        'username' => 'password',

Now point the browser to http://yoursite.com/admin/ and click on ‘INSTALL YOURLS’.


You are reading this post on Joel G Mathew’s tech blog. Joel's personal blog is the Eyrie, hosted here.