This repository has been archived on 2020-09-27. You can view files and clone it, but cannot push or open issues or pull requests.
ansible-role-warehost/warehost-host/templates/caddy.conf

50 lines
1.2 KiB
Plaintext

#jinja2:variable_start_string:'[%' , variable_end_string:'%]'
# ID: {{.ID}} - Domain: {{.Domain.ID}} - Profil: {{.Domain.Profil.ID}}
# Login: {{.Domain.Profil.Login.ID}} -> {{.Domain.Profil.Login.Username}}
# {{.Subdomain}} - {{.Domain.FQDN}}
{{ define "domain" }}{{if .Subdomain}}{{.Subdomain}}.{{end}}{{.Domain.FQDN}}{{ end }}
{{ define "content"}}
{{if not .Redirect}}
gzip
{{if .Proxy}}
proxy / {{.Proxy}}
{{else}}
root [% warehost_host_web_webroot %]/{{template "domain" .}}
{{if .PHP}}
fastcgi / unix:/run/php-fpm/php-fpm.sock php {
env PHP_ADMIN_VALUE "open_basedir=/tmp:/usr/share/webapps/:/etc/webapps/:/usr/share/pear:/dev/urandom:[% warehost_host_web_webroot %]/{{template "domain" .}}"
}
rewrite {
to {path} {path}/ /index.php?_url={uri}
}
{{end}}
{{end}}
{{else}}
redir https://{{.Redirect}}{uri}
{{end}}
{{end}}
{{if .SSL}}
{{if .SSLRedirect}}
http://{{template "domain".}} {
{{if not .Redirect}}
redir https://{{template "domain".}}{uri}
{{else}}
{{template "content" .}}
{{end}}
}
https://{{template "domain".}} {
{{template "content" .}}
}
{{else}}
http://{{template "domain" .}},https://{{template "domain".}} {
{{template "content" .}}
}
{{end}}
{{else}}
http://{{template "domain".}} {
{{template "content" .}}
}
{{end}}