#yourls #mysql #ubuntu #shorturl #redirect #html #apache #php
Sudo apt update
[[Install Apache WebServer]]
```
sudo apt install php libapache2-mod-php php-mysql
```
```
sudo systemctl restart apache2
```
Test if #apache and #php is working properly:
```
echo "<?php phpinfo(); ?>" | sudo tee /var/www/html/info.php
```
Go to http://<ipadres>/info.php
```
sudo rm /var/www/html/info.php
```
Grab the latest [release](https://github.com/YOURLS/YOURLS/releases)
For example :
```
cd /var/www/html
```
```
curl -L -o YOURLS-1.9.2.zip https://github.com/YOURLS/YOURLS/archive/refs/tags/1.9.2.zip
```
Unzip the YOURLS archive to /var/www/html unzip 1.9.2.zip
move the files to the proper place, by cd to the extracted folder and do ```
mv .* * /var/html/www
```
Copy user/config-sample.php to user/config.php
Fill user/config.php with the required settings:
For Example:
Upload the unzipped files to your website, generally in public_html or www folder
Create a new database (see Configuration – you can also use an existing one)
Create a Database:
```
CREATE DATABASE yourls_db;
```
```
CREATE USER 'yourls_user'@'localhost' IDENTIFIED BY 'sterk_wachtwoord';
```
```
GRANT ALL PRIVILEGES ON yourls_db.* TO 'yourls_user'@'localhost';
```
```
FLUSH PRIVILEGES;
```
```
EXIT;
```
Point your browser to https://your-own-domain-here.com/admin/
Follow the installation procedure
TROUBLESHOOTING TIPS:
Controleer of de Apache mod_rewrite module is ingeschakeld: Apache moet de mod_rewrite module hebben ingeschakeld om de URL-rewriting correct te laten werken. Voer de volgende command uit om dit te activeren:
```
sudo a2enmod rewrite
```
Herstart daarna Apache:
```
sudo systemctl restart apache2
```
Controleer de Apache-configuratie voor de YOURLS-directory: Zorg ervoor dat de AllowOverride directief is ingesteld op All voor de directory waar YOURLS geïnstalleerd is. Open de Apache-configuratie voor de website (meestal te vinden in /etc/apache2/sites-available/000-default.conf of een vergelijkbaar bestand):
```
sudo nano /etc/apache2/sites-available/000-default.conf
```
Zoek de <Directory> sectie die betrekking heeft op de YOURLS-directory, bijvoorbeeld:
apache
```
<Directory /var/www/html>
AllowOverride All
</Directory>
```
Add this to the end of the file.
Then, edit /var/www/html/.htaccess and copy and paste the following:
```
# BEGIN YOURLS
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^.*$ /yourls-loader.php [L]
</IfModule>
# END YOURLS
```
Save the file and do:
```chmod 666 /var/www/html/.htacess ```
Restart Apache:
```
sudo systemctl restart apache2
```
Controleer DNS-configuratie: Zorg ervoor dat de domeinnaam s.janvanderwijk.tech correct is ingesteld en verwijst naar het IP-adres van je server.
Als je na deze stappen nog steeds problemen ervaart, kun je de Apache error logs controleren voor meer informatie:
```
sudo tail -f /var/log/apache2/error.log
```
Zie ook [[Install MYSQL, Ubuntu Server Linux Debian]]
Zie ook [[Install Apache WebServer]]
Zie ook [[Unzip files on AIX]]
Zie ook [Frequent Issues](https://yourls.org/docs/guide/troubleshooting/frequent-issues)