In this tutorial, we'll show you how to install Simple-URL-Shortener on Alpine Linux Latest from GitHub.
To install Simple-URL-Shortener, we'll need to install some dependencies first. Run the following command to install the required dependencies:
apk add --no-cache mariadb mariadb-client mariadb-server-utils php7 php7-fpm php7-mysqli php7-json php7-gd php7-curl php7-mbstring php7-zip php7-simplexml supervisor curl git nginx
Run the following command to clone the Simple-URL-Shortener repository from GitHub:
git clone https://github.com/azlux/Simple-URL-Shortener.git /var/www/html/Simple-URL-Shortener
Create a new database in MariaDB by running the following command:
mysql -u root -p
Once you're in the MySQL shell, create a new database by running the following query:
CREATE DATABASE urlshortener;
Next, create a user and grant privileges to the database. Replace <password>
with a strong password:
CREATE USER 'urlshortener'@'localhost' IDENTIFIED BY '<password>';
GRANT ALL PRIVILEGES ON urlshortener.* TO 'urlshortener'@'localhost';
FLUSH PRIVILEGES;
EXIT;
Run the following command to open the Nginx configuration file:
nano /etc/nginx/conf.d/Simple-URL-Shortener.conf
Add the following contents to the file:
server {
listen 80;
server_name example.com;
root /var/www/html/Simple-URL-Shortener/public;
index index.php index.html index.htm;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_pass unix:/run/php-fpm7.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
Save and close the file and then run the following command to open the PHP configuration file:
nano /etc/php7/php-fpm.d/www.conf
Find the following two lines:
;listen = 127.0.0.1:9000
;listen = /run/php-fpm7.sock
Uncomment the second line and change it to:
listen = /run/php-fpm7.sock
Save the file and exit.
Run the following command to create a Supervisor configuration file:
nano /etc/supervisor/conf.d/urlshortener.conf
Add the following contents to the file:
[program:urlshortener-worker]
process_name=%(program_name)s_%(process_num)02d
command=php /var/www/html/Simple-URL-Shortener/artisan queue:work --sleep=3 --tries=3 --daemon
user=www-data
numprocs=2
autostart=true
autorestart=true
Save the file and exit.
Run the following commands to start the services:
service nginx restart
service php-fpm7 restart
supervisorctl reread
supervisorctl update
supervisorctl start urlshortener-worker:*
To access Simple-URL-Shortener, go to http://<your_server's_ip_address>/admin
on your web browser.
You'll be asked to log in. Enter the following login details:
Email: admin@example.com
Password: password
That's it! You're now ready to use Simple-URL-Shortener on Alpine Linux Latest.
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!