Simple-URL-Shortener is an open-source, self-hosted URL shortener written in PHP. It can help you shorten long URLs and make them easy to share. In this tutorial, we will show you how to install Simple-URL-Shortener on Debian Latest.
Before you start, you need to have the following:
First, log in to the Debian server and update the system to the latest version:
sudo apt update
sudo apt upgrade
Simple-URL-Shortener requires some packages to be installed before it can be installed. You can install the required packages with the following command:
sudo apt install apache2 php php-curl php-mbstring php-intl php-mysql mariadb-server
You need to create a database for Simple-URL-Shortener. You can do this by running the following commands:
sudo mysql -u root
After logging in to MySQL, create a database named "simple-url-shortener":
CREATE DATABASE simple-url-shortener;
Then, create a user named "shortener" with a password:
CREATE USER 'shortener'@'localhost' IDENTIFIED BY 'YOUR_PASSWORD';
Grant privileges to the user on the database:
GRANT ALL PRIVILEGES ON simple-url-shortener.* TO 'shortener'@'localhost';
Finally, exit the MySQL interface:
exit
Download the latest version of Simple-URL-Shortener from GitHub:
wget https://github.com/azlux/Simple-URL-Shortener/archive/master.zip
Extract the downloaded archive to the /var/www directory:
sudo unzip master.zip -d /var/www/
sudo mv /var/www/Simple-URL-Shortener-master /var/www/simple-url-shortener
Change the ownership of the /var/www/simple-url-shortener directory to the Apache user and group:
sudo chown -R www-data:www-data /var/www/simple-url-shortener
Create a virtual host for Simple-URL-Shortener:
sudo nano /etc/apache2/sites-available/simple-url-shortener.conf
Add the following lines to the configuration file:
<VirtualHost *:80>
ServerName YOUR_DOMAIN_NAME
DocumentRoot /var/www/simple-url-shortener
<Directory /var/www/simple-url-shortener>
Options FollowSymLinks
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
Replace YOUR_DOMAIN_NAME with the actual domain name of your website.
Enable the virtual host:
sudo a2ensite simple-url-shortener.conf
Restart the Apache service:
sudo systemctl restart apache2
Create a copy of the config.sample.php file and rename it to config.php:
cd /var/www/simple-url-shortener/
cp config.sample.php config.php
Open the config.php file and update the database credentials:
nano config.php
Change the following lines:
define('DB_HOST', 'localhost');
define('DB_NAME', 'simple-url-shortener');
define('DB_USER', 'shortener');
define('DB_PASSWORD', 'ENTER_YOUR_PASSWORD_HERE');
Replace ENTER_YOUR_PASSWORD_HERE with the actual password you set for the "shortener" user.
Save and close the file.
You can now test Simple-URL-Shortener by visiting your domain name in your web browser.
http://YOUR_DOMAIN_NAME/
You should see the installation screen.
Follow the on-screen instructions to finish the installation.
In this tutorial, you learned how to install Simple-URL-Shortener on Debian Latest. You can now use Simple-URL-Shortener to shorten long URLs and share them easily. Enjoy!
If you want to self-host in an easy, hands free way, need an external IP address, or simply want your data in your own hands, give IPv6.rs a try!
Alternatively, for the best virtual desktop, try Shells!