# Caddy Webserver Config

For Hauer-Heinrich

# Wichtige File Paths

\### Equivalent to vhosts:  
/etc/caddy/sites  
  
\### configs zum importieren / Snippets  
\### ähnlich statischer php class  
/etc/caddy/snippets

# Caddy Server Befehle

Caddy Server neustarten:

```shell
systemctl restart caddy
```

Caddy Status check

```shell
systemctl status caddy
```

Caddy config validation:

```shell
cd /etc/caddy && caddy validate
```

# Funktionierende Caddy config

Bei awg.de geht die config.

Bei der neueren Struktur muss darauf geachtet werden, dass in den Config Datein überall der richtige Pfad mit gegeben wird.

# Neue PHP Version Installieren / Ubuntu

\[Install new PHP Version (Ubuntu-caddy v2)\]  
\----------------  
\## option wenn noch nicht geschehen (z. B. beim aller ersten mal)  
`sudo add-apt-repository ppa:ondrej/php`  
`sudo apt update`

\## install PHP \[version\] mit entsprechenden Packages (bereits installiere Packages für bestehende PHP Version ausgeben: `dpkg -l | grep php8.4`)  
`sudo apt install php8.4 php8.4-cli php8.4-common php8.4-fpm php8.4-mysql php8.4-xml php8.4-mbstring php8.4-curl php8.4-opcache php8.4-gd php8.4-gmagick php8.4-intl php8.4-readline php8.4-zip`

`sudo systemctl start php8.4-fpm`  
`sudo systemctl enable php8.4-fpm`

\## then change your php verion  
`nano /etc/caddy/sites/[site-name-file]`

`sudo systemctl restart caddy`

  
\[PHP Package nachträglich installieren (Ubuntu-caddy v2)\]  
\----------------  
`sudo apt install php8.4-mbstring`  
`sudo systemctl restart php8.4-fpm`

\[HINWEIS:\]  
\----------------  
Es muss für den entsprechenden User auch eine entsprechende PHP-FPM config geben:

`nano /etc/php/8.4/fpm/pool.d/[USER].conf`  
e. g. /etc/php/8.4/fpm/pool.d/app-hh-theme-default.conf