mirror of
https://github.com/nextcloud/all-in-one.git
synced 2025-03-03 17:27:22 +08:00
Merge pull request #2569 from nextcloud/enh/noid/caddy-fix-syntax
caddy - a bugfix and some improvements
This commit is contained in:
commit
d5937d3990
8 changed files with 47 additions and 44 deletions
|
@ -16,12 +16,49 @@
|
|||
|
||||
{$PROTOCOL}://{$NC_DOMAIN}:{$APACHE_PORT} {
|
||||
|
||||
# Bundled
|
||||
import /caddy-imports/*
|
||||
# Collabora
|
||||
route /browser/* {
|
||||
reverse_proxy {$COLLABORA_HOST}:9980
|
||||
}
|
||||
route /hosting/* {
|
||||
reverse_proxy {$COLLABORA_HOST}:9980
|
||||
}
|
||||
route /cool/* {
|
||||
reverse_proxy {$COLLABORA_HOST}:9980
|
||||
}
|
||||
|
||||
# Notify Push
|
||||
route /push/* {
|
||||
uri strip_prefix /push
|
||||
reverse_proxy {$NEXTCLOUD_HOST}:7867
|
||||
}
|
||||
|
||||
# Onlyoffice
|
||||
route /onlyoffice/* {
|
||||
uri strip_prefix /onlyoffice
|
||||
reverse_proxy {$ONLYOFFICE_HOST}:80 {
|
||||
header_up X-Forwarded-Host {http.request.host}/onlyoffice
|
||||
header_up X-Forwarded-Proto https
|
||||
}
|
||||
}
|
||||
|
||||
# Talk
|
||||
route /standalone-signaling/* {
|
||||
uri strip_prefix /standalone-signaling
|
||||
reverse_proxy {$TALK_HOST}:8081
|
||||
}
|
||||
|
||||
# Others
|
||||
import /mnt/data/caddy-imports/*
|
||||
|
||||
# Nextcloud
|
||||
route {
|
||||
rewrite /.well-known/carddav /remote.php/dav
|
||||
rewrite /.well-known/caldav /remote.php/dav
|
||||
header Strict-Transport-Security max-age=31536000;
|
||||
reverse_proxy localhost:8000
|
||||
}
|
||||
|
||||
# TLS options
|
||||
tls {
|
||||
issuer acme {
|
||||
|
|
|
@ -7,8 +7,6 @@ COPY --from=caddy /usr/bin/caddy /usr/bin/caddy
|
|||
|
||||
COPY --chown=33:33 Caddyfile /Caddyfile
|
||||
COPY --chmod=664 nextcloud.conf /usr/local/apache2/conf/nextcloud.conf
|
||||
COPY --chmod=664 nextcloud /nextcloud
|
||||
COPY --chmod=664 caddy-imports/* /caddy-imports/
|
||||
COPY --chmod=664 supervisord.conf /supervisord.conf
|
||||
COPY --chmod=775 start.sh /start.sh
|
||||
COPY --chmod=775 healthcheck.sh /healthcheck.sh
|
||||
|
|
|
@ -1,10 +0,0 @@
|
|||
# Collabora
|
||||
route /browser/* {
|
||||
reverse_proxy {$COLLABORA_HOST}:9980
|
||||
}
|
||||
route /hosting/* {
|
||||
reverse_proxy {$COLLABORA_HOST}:9980
|
||||
}
|
||||
route /cool/* {
|
||||
reverse_proxy {$COLLABORA_HOST}:9980
|
||||
}
|
|
@ -1,5 +0,0 @@
|
|||
# Notify Push
|
||||
route /push/* {
|
||||
uri strip_prefix /push
|
||||
reverse_proxy {$NEXTCLOUD_HOST}:7867
|
||||
}
|
|
@ -1,8 +0,0 @@
|
|||
# Onlyoffice
|
||||
route /onlyoffice/* {
|
||||
uri strip_prefix /onlyoffice
|
||||
reverse_proxy {$ONLYOFFICE_HOST}:80 {
|
||||
header_up X-Forwarded-Host {http.request.host}/onlyoffice
|
||||
header_up X-Forwarded-Proto https
|
||||
}
|
||||
}
|
|
@ -1,5 +0,0 @@
|
|||
# Talk
|
||||
route /standalone-signaling/* {
|
||||
uri strip_prefix /standalone-signaling
|
||||
reverse_proxy {$TALK_HOST}:8081
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
# Nextcloud
|
||||
route /* {
|
||||
rewrite /.well-known/carddav /remote.php/dav
|
||||
rewrite /.well-known/caldav /remote.php/dav
|
||||
header Strict-Transport-Security max-age=31536000;
|
||||
reverse_proxy localhost:8000
|
||||
}
|
|
@ -39,15 +39,12 @@ echo "$CADDYFILE" > /Caddyfile
|
|||
|
||||
# Change the trusted_proxies in case of reverse proxies
|
||||
if [ "$APACHE_PORT" != '443' ]; then
|
||||
CADDYFILE="$(sed 's|# trusted_proxies placeholder|trusted_proxies private_ranges|' /Caddyfile)"
|
||||
CADDYFILE="$(sed 's|# trusted_proxies placeholder|trusted_proxies static private_ranges|' /Caddyfile)"
|
||||
else
|
||||
CADDYFILE="$(sed 's|trusted_proxies private_ranges|# trusted_proxies placeholder|' /Caddyfile)"
|
||||
CADDYFILE="$(sed 's|trusted_proxies.*private_ranges|# trusted_proxies placeholder|' /Caddyfile)"
|
||||
fi
|
||||
echo "$CADDYFILE" > /Caddyfile
|
||||
|
||||
# Overwrite nextcloud conf
|
||||
cat /nextcloud > /mnt/data/caddy-imports/nextcloud
|
||||
|
||||
# Fix the Caddyfile format
|
||||
caddy fmt --overwrite /Caddyfile
|
||||
|
||||
|
@ -57,6 +54,12 @@ mkdir -p /mnt/data/caddy/
|
|||
# Add caddy import path
|
||||
mkdir -p /mnt/data/caddy-imports
|
||||
|
||||
# Remove falsely added Nextcloud conf
|
||||
rm -f /mnt/data/caddy-imports/nextcloud
|
||||
|
||||
# Makre sure that the caddy-imports dir is not empty
|
||||
echo "" > /mnt/data/caddy-imports/empty
|
||||
|
||||
# Fix apache startup
|
||||
rm -f /usr/local/apache2/logs/httpd.pid
|
||||
|
||||
|
|
Loading…
Reference in a new issue