Simple-URL-Shortener is an open-source URL shortener developed by azlux. This tutorial will guide you through the installation process on macOS.
Open the Terminal app and run the command below to install the required dependencies:
brew install nginx php@7.3 mariadb
This will install Nginx as the web server, PHP 7.3 as the scripting language, and MariaDB as the database.
Run the following command to clone the Simple-URL-Shortener repository to your computer:
git clone https://github.com/azlux/Simple-URL-Shortener.git
This will create a new directory called Simple-URL-Shortener
in your current directory.
Copy the Nginx configuration file from the repository to the Nginx configuration directory by running the command below:
sudo cp Simple-URL-Shortener/nginx.conf /usr/local/etc/nginx/
Next, open the Nginx configuration file in any text editor of your choice using the command:
sudo nano /usr/local/etc/nginx/nginx.conf
Find the line below:
root /usr/local/www/nginx;
Replace it with:
root /path/to/Simple-URL-Shortener/;
Remember to replace /path/to/Simple-URL-Shortener/
with the actual path to your Simple-URL-Shortener directory.
Save and close the file.
Test the Nginx configuration using the command:
sudo nginx -t
If there are no errors, restart Nginx using the command:
sudo brew services restart nginx
Run the command below to log in to the MySQL server as the root user:
sudo mysql -u root
Create a new database named url_shortener
and a new user with all privileges on the url_shortener
database using the commands below:
CREATE DATABASE url_shortener;
CREATE USER 'urlshortener'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON url_shortener.* TO 'urlshortener'@'localhost';
FLUSH PRIVILEGES;
Remember to replace password
in the command above with your own password.
Exit the MySQL server by running the command:
exit
Copy the config.php.example
file to config.php
by running the following command:
cp Simple-URL-Shortener/config.php.example Simple-URL-Shortener/config.php
Open the config.php
file in any text editor of your choice using the command:
nano Simple-URL-Shortener/config.php
Make the following changes:
URL_SHORTENER_DB_NAME
constant to url_shortener
URL_SHORTENER_DB_USER
constant to urlshortener
URL_SHORTENER_DB_PASSWORD
constant to the password you set for the urlshortener
user earlierSave and close the file.
Open your web browser and enter the URL http://localhost
. If everything is working correctly, you should see the Simple-URL-Shortener homepage.
Congratulations! You have successfully installed Simple-URL-Shortener on your macOS system. You can now start using it to shorten URLs.
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!