This repository contains static images used for the Discord bot Salamandra and the website amphibian.fr.
Note
This procedure is tailored to my specific use case. Feel free to setup the Cdn in any way that suits you.
Ensure you have the following prerequisites installed:
- Caddy: Install Caddy
-
Create the
cyberia
Directory:
Navigate to/var/www
, create a directory namedcyberia
, and change the owner and group to your main user (for me, it's salamandra).cd /var/www sudo mkdir cyberia sudo chown salamandra:salamandra cyberia
-
Clone the Repository:
As the main user (in my case, salamandra), clone this repository into the cyberia directory.cd /var/www/cyberia git clone git@github.com:Lounek09/Cyberia.Cdn.git mv Cyberia.Cdn Cdn
-
Configure Caddy:
Edit the Caddy configuration file located at/etc/caddy/Caddyfile
to include the following block, remove the default configuration if present. Replace your-domain.com with your actual domain:(common) { header -Server } cdn.your-domain.com { import common root * /var/www/cyberia/Cdn file_server { hide .git .github README.md } encode gzip header Cache-Control max-age=1209600 }
For more information, see the Caddiyfile documentation.
-
Restart Caddy:
Restart the Caddy service to apply the new configuration1:sudo systemctl restart caddy
Footnotes
-
If the service fails to start due to missing permissions, it's likely because Caddy creates certain directories without the correct permissions. Try the following command after each restart until it works:
sudo chmod -R 755 /var/lib/caddy/.local
↩