Skip to content

Latest commit

 

History

History
59 lines (46 loc) · 1.98 KB

README.md

File metadata and controls

59 lines (46 loc) · 1.98 KB

Cyberia.Cdn

This repository contains static images used for the Discord bot Salamandra and the website amphibian.fr.

Setup

Note

This procedure is tailored to my specific use case. Feel free to setup the Cdn in any way that suits you.

Prerequisites

Ensure you have the following prerequisites installed:

Installation Steps

  1. Create the cyberia Directory:
    Navigate to /var/www, create a directory named cyberia, 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
  2. 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
  3. 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.

  4. Restart Caddy:
    Restart the Caddy service to apply the new configuration1:

    sudo systemctl restart caddy

Footnotes

  1. 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