How about turning the most important tool you use in your online business into a money-making business? Don’t know what I am talking about? Then you haven’t watched our video on the most important tool you should start using in your business. In this article, I will be showing you how to set up your premium URL shortener and turn it into a business that can get you thousands of dollars per month.

What is SAAS?

You surely are using Netflix to watch movies, Grammarly to correct your grammar and spelling as you are writing, or L-ink.me to shorten and track your links. All of these are SAAS examples.

SAAS; or software as a service, is a cloud-based service where instead of downloading software to your desktop PC or business network to run and update, you instead access an application via an internet browser.

We will help you build the same tool as L-ink.me. Use it in your own business, or even start a money-making Premium URL Shortener SAAS business online. If you want to also create a blog, check our articles here and here.

Premium URL Shortener Setup

Let’s start together learning how to build our premium URL shortener.

Requirements

What are the requirements needed for the setup?

Getting the Premium URL Shortener script

The script we are going to use in this setup can be bought by anyone. It costs only 33$ to buy this script and start using it in your own business.

Getting a domain name

A domain name is crucial. Like in our case, the domain name we are using is l-ink.me. You have to get a domain name to use for your service.

Domain names can be bought cheaply from below providers.

Getting a VPS server

What is a VPS Server?

When you want to publish a PHP website or script or any web application, we do what we call “web hosting” which simply means uploading the files and database into a public server so it can be accessibly Online over the internet.

The place where we are going to host our service will be on a VPS server. It is very recommended to get a dedicated VPS server to benefit from the best performance for your service.

Where you can get a VPS? From below of course.

In our case, we will be using Contabo as it provides the best offer but you can choose any provider you feel comfortable with.

So, let’s begin.

Note: In this tutorial: I will be using Contabo

So Let’s see how we can get a VPS server from Contabo.

Get a VPS Server From Contabo.

1: Open Contabo Website.

Open your web browser and navigate to Contabo VPS Page.

You will see multiple VPS configuration to start with. You can simply start with the cheapest option to Install WordPress, it will be more than enough.

Later on, when you grow your business, you can scale up and get a more powerful VPS with Higher resources.

2: Set VPS Options

On the Next Page, you will need to select some options

In the Operating System Option, Select Ubuntu 20.04

Select Ubuntu 18.04

Then in the Administration Panel, Select LAMP

SELECT LAMP

And last option, In the Addons, check “Individual reverse DNS”

Add PTR

If you were promoted to enter the PTR record, enter your domain name, and That’s it.

Now, Just Continue to the billing page, and confirm your order. I think other steps are simple and self-explanatory.

In like 24 hours, Contabo Team will setup the Server and send the details to your email like this:

Login Info

Map Domain Name to your VPS Server.

Ok Friend, Now we have a Domain and a VPS Server. But they are not connected!

Your VPS Server can be accessed now through the IP address that Contabo Team sent you by email. but of course, we don’t want to access our WordPress website through an IP! We want to use our domain name.

So simply, we are going to map the domain name to our VPS IP, so then we access the VPS and the WordPress website through both the domain and the IP.

Configure your DNS Records:

Simply open DNS management zone in your Domain Provider (Godaddy in my case) and edit the main  A record like this:

host: @ points: YOUR SERVER IP.

Done? Great! ✔️

Upload The Script Files To The Server.

First, download the script from codecanyon.

Now unzip the file you download from the site. Then upload the main.zip inside to your server.

To upload the files, you need an application called WinSCP.

It is a free tool and you can download it from here.

Connect to Your VPS Server using WinSCP, and Update the PHP Files to the server to this path: “/var/www/html”

In most cases, the files would be zipped, so we need to extract them.

Connect to your VPS server using any SSH client like putty. and Let’s

Just open Putty and enter the Server IP or Name, and Press Open.

It will ask you to login, just enter “root” as the user, then enter your password which is sent to you by email.

Note: while typing the password, putty will now show it for security reasons, but It’s there, just type it!

Login with putty

And you are In! 

Let’s install the unzip utility using the following command:

sudo apt-get install unzip

Clear putty screen to make in clean using the following command:

clear

Change directory to /var/www/html using the following command:

cd /var/www/html

Unzip the “.zip” file using the following command:

unzip YOURFILENAME*.zip

*Note: the file name may be different in your case, so replace YOURFILENAME with your file name.

Now, Move the latest folder content to the upper directory so it can be accessed directly -> use WinSCP
Just copy all the files inside “YOURFILENAME” folder and paste them directly in html folder.

Files Uploaded. Done! ✔️

Create a Database

Again to Putty SSH Client and Let’s create our database using the following commands.

What’s nice, is that we have MySQL installed already as part of the LAMP Stack, but we need to create a database and a user for out application.

To get started, log into the MySQL root (administrative) account by issuing this command:

mysql -u root -p

You will be prompted for the root password, just write or paste it and press Enter.

First, create a separate database that your PHP application will use. You can call this whatever you want, but we will be using TestDb (you can use any name you want)in this guide to keep it simple. Create the database by running this command:

CREATE DATABASE TestDb DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;

Note: Every MySQL statement must end in a semi-colon (;)

Next, we are going to create a separate MySQL user account that we will use exclusively to operate on our new database. Creating one-function databases and accounts is a good idea from a management and security standpoint. We will use the name DbUser in this guide. Feel free to change this if you’d like.

We are going to create this account, set a password, and grant access to the database we created. We can do this by typing the following command. Remember to choose a strong password here for your database user:

CREATE USER 'DbUser'@'localhost' IDENTIFIED BY 'enter_a_custom_password_here';
GRANT ALL ON TestDb.* TO 'DbUser'@'localhost';

You now have a database and user account, each made specifically for Your PHP application. We need to flush the privileges so that the current instance of MySQL knows about the recent changes we’ve made:

FLUSH PRIVILEGES;

Exit out of MySQL by typing:

EXIT;

Done! ✔️

Configure the Premium URL Shortener

Now that we have uploaded the script to the server and created the database, it is time to start configuring our application.

Open any web browser and add your domain name in the address bar.

As you can see, we are in the premium URL shortener installation page.

This will show you all the requirements needed and what is still missing. So, let’s fix what is missing!

The first problem we see is the config_sample.php is not accessible. Let’s give the needed privileges.

This file can be found in /var/www/html/includes/ so open WinSCP and navigate to the needed directory.

Now right click on the file and set the permission to 777 as shown below.

Now, let’s fix the content/ folder. In the same way, go to /var/www/html and right-click on the content folder and give the 777 permissions in the same way. One more thing is to check the box below.

Now refresh the page and you can see that the issue has been solved. Very nice.

Now since all requirements are met, we can proceed by pressing this sentence. Sure!

Connect to database

It is time to connect to our database.

Just fill in the needed info for host(localhost) dbname and user you created with the password.

Now create the configuration file.

Oh no! We have the below error.

Let’s solve.

Go again to WinSCP, into /var/www/html/includes, and let’s rename the config_sample.php file to config.php.

Go back to your web browser, and voila, database is successfully imported!

After that, just enter you admin details and continue.

Then delete install.php.

And awesome! Our application is installed and is ready to be used.

To change your landing page, you can use another theme. In our service l-ink.me, we are using a theme. You can check it out, but this is totally optional.

We have one last thing to fix. Try to log in to your application and you will get an error.

To fix this, copy below block to /etc/apache2/sites-enabled/000-default.conf file.

Open 000-default.conf then copy and paste the content below into the file and save.

     <Directory /var/www/html/>
        Options +FollowSymlinks
        AllowOverride All
        Require all granted
     </Directory>

You can see how we did this in the below image.

After this, just restart the apache service using putty.

sudo systemctl restart apache2.service 

Now go back to the website and refresh the page. Try to log in. Awesome! Now everything is working properly, and your application is ready!

Secure Premium URL Shortener with a Free SSL.

SSL certificates are used within web servers to encrypt the traffic between the server and client, providing extra security for users accessing your application. Let’s Encrypt provides an easy way to obtain and install trusted certificates for free.

Connect to your Server using Putty SSH client. and Let’s Start!

Step 1 — Install the Let’s Encrypt Client

Let’s Encrypt certificates are fetched via client software running on your server. The official client is called Certbot.

First, add the repository to install Certbot:

 sudo add-apt-repository ppa:certbot/certbot 

You’ll need to press ENTER to accept.

Then, Update the package list to pick up the new repository’s package information:

 sudo apt-get update 

Install Certbot’s Apache package:

 sudo apt install python-certbot-apache 

Certbot is now ready to be used.

Step 2 — Set Up the SSL Certificate

Generating the SSL certificate for Apache using Certbot is quite straightforward. The client will automatically obtain and install a new SSL certificate that is valid for the domains provided as parameters.

Simply run the following command: (change the domain)

 sudo certbot --apache -d YOUR_DOMAIN_NAME

You will be asked to provide an email address for lost key recovery and notices, and you will be able to choose between enabling both http and https access or forcing all requests to redirect to https. It is usually safest to require https, unless you have a specific need for unencrypted http traffic.

That’s it! 

Test your website now and it should be SSL encrypted.

Done! ✔️

Summary

To sum up all what you need:

  • Get a Domain Name.
  • Get a VPS Server.
  • Map Server IP to Domain.
  • Uploading File to the Server using WinSCP.
  • Create a MySQL Database For Your Application.
  • Managing MySQL Databases.

Once you have done all of this, you will have your premium url shortener service up and running.