diff --git a/shortener/.gitignore b/shortener/.gitignore new file mode 100644 index 0000000..471bcf4 --- /dev/null +++ b/shortener/.gitignore @@ -0,0 +1 @@ +links/ diff --git a/shortener/README.md b/shortener/README.md new file mode 100644 index 0000000..155d5f2 --- /dev/null +++ b/shortener/README.md @@ -0,0 +1,32 @@ +# ash.ley + +A simple link shortener. Its a single PHP script which requires a small about of webserver configuration. Adding new links just requires adding a file to the `links/` folder containing the URL to link to. + +## Webserver configuration + +```nginx +server { + server_name ash.ley; + root /var/www/ash.ley; + + location ~ ^/links { + deny all; + } + + location / { + try_files @ashdotley; + } + + location @ashdotley { + rewrite ^/(.*) /index.php?id=$1&$args last; + } + + location ~ ^/index.php$ { + include fastcgi_params; + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + fastcgi_param REDIRECT_STATUS 200; + fastcgi_pass unix:/var/run/php/php7.4-fpm.sock; + } +} +``` + diff --git a/shortener/index.php b/shortener/index.php new file mode 100644 index 0000000..415fa57 --- /dev/null +++ b/shortener/index.php @@ -0,0 +1,22 @@ +not found"; + echo 'nyy-a?'; + } +} else { + echo "