108 lines
2.1 KiB
Caddyfile
108 lines
2.1 KiB
Caddyfile
# Written by vpn-router-setup from /etc/vpn-router/vpn-router.json and the web sites; edits are overwritten.
|
|
{
|
|
auto_https disable_redirects
|
|
{%- if https_email %}
|
|
email {{ https_email }}
|
|
{%- endif %}
|
|
{%- if pki_cas %}
|
|
skip_install_trust
|
|
pki {
|
|
{%- for ca in pki_cas %}
|
|
ca {{ ca.id }} {
|
|
name "{{ ca.name }}"
|
|
root {
|
|
cert {{ ca.cert }}
|
|
key {{ ca.key }}
|
|
}
|
|
intermediate {
|
|
cert {{ ca.cert }}
|
|
key {{ ca.key }}
|
|
}
|
|
}
|
|
{%- endfor %}
|
|
}
|
|
{%- endif %}
|
|
}
|
|
{% if https and (web_enabled or 'https' in pki_publish or acme_cas) %}
|
|
{{ local_fqdn }}:{{ https_web_port }} {
|
|
{%- if 'https' in pki_publish %}
|
|
handle_path /pki/* {
|
|
root * {{ pki_publish_dir }}
|
|
file_server
|
|
}
|
|
{%- endif %}
|
|
{%- for ca in acme_cas %}
|
|
handle /acme/{{ ca }}/* {
|
|
acme_server {
|
|
ca {{ ca }}
|
|
}
|
|
}
|
|
{%- endfor %}
|
|
handle {
|
|
{%- if web_enabled %}
|
|
reverse_proxy {{ loopback }}:{{ web_port }}
|
|
{%- else %}
|
|
respond 404
|
|
{%- endif %}
|
|
}
|
|
}
|
|
{% endif %}
|
|
{%- if https and 'http-80' in pki_publish %}
|
|
http://{{ local_fqdn }} {
|
|
handle_path /pki/* {
|
|
root * {{ pki_publish_dir }}
|
|
file_server
|
|
}
|
|
handle {
|
|
respond 404
|
|
}
|
|
}
|
|
{% endif %}
|
|
{%- if https and 'https-default' in pki_publish %}
|
|
{{ local_fqdn }}:443 {
|
|
handle_path /pki/* {
|
|
root * {{ pki_publish_dir }}
|
|
file_server
|
|
}
|
|
handle {
|
|
respond 404
|
|
}
|
|
}
|
|
{% endif %}
|
|
{%- if https and manager_port %}
|
|
{{ local_fqdn }}:{{ https_manager_port }} {
|
|
reverse_proxy {{ loopback }}:{{ manager_port }}
|
|
}
|
|
{% endif %}
|
|
{%- if https and metrics_enabled %}
|
|
{{ local_fqdn }}:{{ metrics_https_port }} {
|
|
reverse_proxy {{ loopback }}:{{ metrics_port }}
|
|
}
|
|
{% endif %}
|
|
{%- if webdav %}
|
|
{{ local_fqdn }}:{{ webdav_port }} {
|
|
reverse_proxy {{ loopback }}:{{ webdav_loopback_port }}
|
|
}
|
|
{% endif %}
|
|
{%- for site in sites %}
|
|
# Site {{ site.name }}
|
|
{{ site.addresses | join(', ') }} {
|
|
root * {{ site.root }}
|
|
{%- if site.tls == 'ca' %}
|
|
tls {
|
|
issuer internal {
|
|
ca {{ site.ca }}
|
|
}
|
|
}
|
|
{%- elif site.tls == 'file' %}
|
|
tls {{ site.cert }} {{ site.key }}
|
|
{%- endif %}
|
|
{%- if site.spa %}
|
|
try_files {path} /{{ site.index }}
|
|
{%- endif %}
|
|
file_server {
|
|
index {{ site.index }}
|
|
}
|
|
}
|
|
{% endfor %}
|