# [[YOURLS]]
%%
date:: [[2024-01-08]]
parent::
%%
[site](https://yourls.org) | [repo](https://github.com/YOURLS)
![[YOURLS.svg]]
YOURLS is a shortcut for Your Own URL Shortener, and it is an [[Open-source]], self-hosted [[URL Shortening|URL shortener]] that uses [[MariaDB]] and is written in [[PHP]].
It was recommended to me by [[Andy Polaine]], and it's one that I currrently use.
## Installing YOURLS on [[Ubuntu]]/[[Linux]]
I followed [these instructions](https://linuxstans.com/how-to-install-yourls/) to install YOURLS on Ubuntu. Here are the general steps:
- [[Installing Nginx on Ubuntu|Install Nginx]].
- Install [[MariaDB]], set it up, and create a database for YOURLS to use.
- Install [[PHP]].
- Install YOURLS.
- Clone [the YOURLS repository](https://github.com/YOURLS/YOURLS.git).
- Edit the YOURLS config to tell it what username and password to use for the database and for the YOURLS UI, as well as what domain to use for shortening.
- Configure the UI.
- [[Setting up server blocks on Nginx|Create a server block on Nginx]] that tells it how to handle requests to your domain (by forwarding it to YOURLS).
- Create an A record on your domain to point to your web server.
- (Optional) [[Installing an SSL certificate on Nginx server with Let's Encrypt and Certbot|Install Let's Encrypt with Certbot]] if you want to use HTTPS.
## Usage
Upon first installing YOURLS on the server, you need to complete installation by going to `/admin/install.php` on your domain. For example, `https://yourdomain.com/admin/install.php`. Click on *Install* and the last bits of installation are completed.
After YOURLS is fully installed, you can use access the YOURLS frontend by going to `/admin/index.php`. This is a web interface for mapping source URLs to short URLs as well as viewing metrics for each link.
## Troubleshooting
### HTTP 404 on `/admin/install.php`
*Problem:* After installing the backend stuff on the server, visiting `https://yourdomain.com/admin/install.php` to finish installation yields a 404.
*Cause:* There's something wrong with your [[Nginx]] config at `/etc/nginx/sites-enabled`.
When I ran into this problem, the cause was that I had *two* declarations for the same server name in two different server blocks. This was due to me having two different config files in `sites-enabled`: the `default` one and the one I actually wanted. When I ran [[Installing an SSL certificate on Nginx server with Let's Encrypt and Certbot|Certbot]], it automatically added a server block to `default` instead of my config, and it double-declared the same server in two different files.
See [[2024-09-13#Setting up YOURLS on Google Cloud Platform GCP]] for more details.
*Solution*: For the problem that I described above, the solution was to:
- `cd /etc/nginx/sites/enabled` and `rm default`. This breaks the symlink.
- Run `certbot --nginx -d domain.com` again and say that I wanted to reinstall the current certificate.
- `systemctl restart nginx`
More abstract: [[HTTP 404 on Nginx]]
%%
# Excalidraw Data
## Text Elements
## Drawing
```json
{
"type": "excalidraw",
"version": 2,
"source": "https://github.com/zsviczian/obsidian-excalidraw-plugin/releases/tag/2.1.4",
"elements": [
{
"id": "4y8R7iOA",
"type": "text",
"x": 118.49495565891266,
"y": -333.44393157958984,
"width": 3.8599853515625,
"height": 24,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 1,
"opacity": 100,
"groupIds": [],
"frameId": null,
"roundness": null,
"seed": 967149026,
"version": 2,
"versionNonce": 939059582,
"isDeleted": true,
"boundElements": null,
"updated": 1713723615080,
"link": null,
"locked": false,
"text": "",
"rawText": "",
"fontSize": 20,
"fontFamily": 4,
"textAlign": "left",
"verticalAlign": "top",
"containerId": null,
"originalText": "",
"lineHeight": 1.2
}
],
"appState": {
"theme": "dark",
"viewBackgroundColor": "#ffffff",
"currentItemStrokeColor": "#1e1e1e",
"currentItemBackgroundColor": "transparent",
"currentItemFillStyle": "solid",
"currentItemStrokeWidth": 2,
"currentItemStrokeStyle": "solid",
"currentItemRoughness": 1,
"currentItemOpacity": 100,
"currentItemFontFamily": 4,
"currentItemFontSize": 20,
"currentItemTextAlign": "left",
"currentItemStartArrowhead": null,
"currentItemEndArrowhead": "arrow",
"scrollX": 583.2388916015625,
"scrollY": 573.6323852539062,
"zoom": {
"value": 1
},
"currentItemRoundness": "round",
"gridSize": null,
"gridColor": {
"Bold": "#C9C9C9FF",
"Regular": "#EDEDEDFF"
},
"currentStrokeOptions": null,
"previousGridSize": null,
"frameRendering": {
"enabled": true,
"clip": true,
"name": true,
"outline": true
}
},
"files": {}
}
```
%%