How to install Premium URL Shortener on DigitalOcean

How to install Premium URL Shortener on DigitalOcean

Premium URL Shortener has evolved so much in time and got complex in terms of features and server requirements. The goal of Premium URL Shortener was always to allow anyone to start their own business online with ease. Many tools were built-in to allow customers to be competitive with larger companies such as Bit.ly. In fact, SaaS feature was added as of version 5.0 to the script and this allows you to charge your customers on a monthly basis automatically via deep Stripe integration. All this power needs a reliable server such as a VPS or Dedicated Server.

There are many services that offer a VPS at a very competitive pricing such as DigitalOcean. DigitalOcean is one of the most reliable cloud hosting platforms out there and their pricing - starting at $5 per month - is very competitive. There are many advantages with using a cloud hosting such as DigitalOcean however there is one major drawback and that is server maintenance. Since these servers are not maintained by the company, you will need to set it up, secure it and maintain it - all this without access to a control panel such as cPanel. While this scares most people, it can be very rewarding and cost effective if you dive into this. As such, this post will outline instruction on how to run your own "Droplet" with Premium URL Shortener.

Step 1 - Deploy your first LAMP Stack Droplet

The first step is to create an account and deploy a LAMP Stack droplet. The LAMP stack droplet has everything we need for this script to get it running. DigitalOcean has pre-built stacks including a LAMP stack that includes Apache 2, PHP 7.2 and mySQL database. This is the fastest method to have a server running and it does not take more than 60 seconds. If you are experienced and want to run a custom stack then you will need to install each component manually. You can follow the instructions on this page otherwise check the video below.

Step 2 - Install Modules and Configure the server

SSH to your server

Open your SSH terminal (if you don't have any, we recommend PuTTy), login as root using the password sent to you via email. Note you will be asked to change your password on your first login.

Check cURL Module

Now you may want to install some modules which might not come by default with the LAMP stack. Mainly we need the cURL module. To verify if curl is installed on the server, run the following command.

curl --version

If you get an error then cURL is not installed by default. You can install it by running the following commands.

sudo apt-get update
sudo apt-get install curl
sudo service apache2 restart

sudo apt-get install php-curl
sudo service apache2 restart

Enable Mod Rewrite Module

You will need to enable the mod_rewrite module on your server if it is not already enabled. This will allow you to use SEO clean URLs such as https://yoursite.com/Alias instead of https://yoursite.com/index.php?Alias. To enable it, simply run the following command.

sudo a2enmod rewrite
sudo service apache2 restart

If enabling does not work and you still get 404 errors, click here to learn more on further steps.

Install unzip module

You will need to install the unzip module before you can use the unzip command to extract zip files. You can use the following command to install it.

sudo apt-get install unzip
sudo service apache2 restart

Install phpMyAdmin

Although not required, it is recommended to install phpMyAdmin to manage the database via the interface versus the terminal. You can follow the instructions on this page.

Add/Associate your domain name

To add your domain name, go to your DigitalOcean control panel then navigate to Networking and add your domain name then associate it with your active Droplet. Make sure to change the Nameservers via your Domain Registrar to the NameServers of DigitalOcean.

Create a mySQL Database

Open the terminal, run the following command to login into mySQL and then create a database.

sudo mysql -u root -p

You will then be asked to enter your mysql root password which you can find in the file /root/.digitalocean_password. You can copy it then paste it via PuTTy with a right click of your mouse. Once logged in, you will see the following mysql> on your window. Run the following command to create a database.

CREATE DATABASE shortener;

This will create a database named shortener that you can use later to setup the script.

Step 3 - Upload and Extract Premium URL Shortener

Once you are done with step 2, go ahead and FTP into your fresh server and go to the path /var/www/html/ and upload the file main.zip. Then open your Terminal and run the following command to extract the files

sudo unzip /var/www/html/main.zip -d /var/www/html/

Change permission

After upload and extraction, make sure to change the permission of the /content folder and the file /includes/config_sample.php to 777

Step 4 - Run the Installer

Once you have extracted all files, visit your website and follow the instructions to install the script and you are good to go. Note: You will find your mySQL root password in the file located in /root/.digitalocean_password. You can now enjoy a dedicated environment where you have full control on your server. You can scale it on demand with a click of a button.

If you don't want to go through the hassle of managing your own server, we provide a Worry-Free Hosting server.