I was hopping to using Caddy v1 to output a JSON file, which should theoretically compatible with V2 , so I can just run to Caddy v2 with little work.
1. Caddy version (caddy version
):
root@caddy:/usr/local/www # caddy -version
v1.0.4
root@caddy:/usr/local/www #
2. How I run Caddy:
package from repository. have try using getcaddy.com as well.
a. System environment:
FreeNAS 11.2-U7
b. Command:
root@caddy:/usr/local/www # caddy -caddyfile-to-json
^C root@caddy:/usr/local/www #
c. Service/unit/compose file:
d. My complete Caddyfile or JSON config:
root@caddy:/usr/local/www # cat Caddyfile
mytest.website.com {
root /usr/local/www/nextcloud
log /var/log/nextcloud_access.log
errors /var/log/nextcloud_errors.log
fastcgi / 127.0.0.1:9000 php {
env PATH /bin
env modHeadersAvailable true
env front_controller_active true
connect_timeout 60s
read_timeout 3600s
send_timeout 300s
}
header / {
Strict-Transport-Security "max-age=15768000;"
X-Content-Type-Options "nosniff"
X-XSS-Protection "1; mode=block"
X-Robots-Tag "none"
X-Download-Options "noopen"
X-Permitted-Cross-Domain-Policies "none"
X-Frame-Options "SAMEORIGIN"
Referrer-Policy "no-referrer"
}
header /core/fonts {
Cache-Control "max-age=604800"
}
# checks for images
rewrite {
ext .png .html .ttf .ico .jpg .jpeg .css .js .woff .woff2 .svg .gif .map
r ^/index.php/.*$
to /{1} /index.php?{query}
}
rewrite {
r ^/\.well-known/host-meta$
to /public.php?service=host-meta&{query}
}
rewrite {
r ^/\.well-known/host-meta\.json$
to /public.php?service=host-meta-json&{query}
}
rewrite {
r ^/\.well-known/webfinger$
to /public.php?service=webfinger&{query}
}
rewrite {
r ^/index.php/.*$
to /index.php?{query}
}
rewrite / {
if {path} not_starts_with /remote.php
if {path} not_starts_with /public.php
ext .png .html .ttf .ico .jpg .jpeg .css .js .woff .woff2 .svg .gif .map .html .ttf
r ^/(.*)$
to /{1} /index.php{uri}
}
rewrite / {
if {path} not /core/img/favicon.ico
if {path} not /core/img/manifest.json
if {path} not_starts_with /remote.php
if {path} not_starts_with /public.php
if {path} not_starts_with /cron.php
if {path} not_starts_with /core/ajax/update.php
if {path} not_starts_with /status.php
if {path} not_starts_with /ocs/v1.php
if {path} not_starts_with /ocs/v2.php
if {path} not /robots.txt
if {path} not_starts_with /updater/
if {path} not_starts_with /ocs-provider/
if {path} not_starts_with /ocm-provider/
if {path} not_starts_with /.well-known/
to /index.php{uri}
}
# client support (e.g. os x calendar / contacts)
redir /.well-known/carddav /remote.php/carddav 301
redir /.well-known/caldav /remote.php/caldav 301
# remove trailing / as it causes errors with php-fpm
rewrite {
r ^/remote.php/(webdav|caldav|carddav|dav)(\/?)(\/?)$
to /remote.php/{1}
}
rewrite {
r ^/remote.php/(webdav|caldav|carddav|dav)/(.+?)(\/?)(\/?)$
to /remote.php/{1}/{2}
}
rewrite {
r ^/public.php/(dav|webdav|caldav|carddav)(\/?)(\/?)$
to /public.php/{1}
}
rewrite {
r ^/public.php/(dav|webdav|caldav|carddav)/(.+)(\/?)(\/?)$
to /public.php/{1}/{2}
}
# .htaccess / data / config / ... shouldn't be accessible from outside
status 404 {
/.htaccess
/data
/config
/db_structure
/.xml
/README
/3rdparty
/lib
/templates
/occ
/console.php
}
}
root@caddy:/usr/local/www #
3. The problem I’m having:
result not expeced
It will stuck for very long time
4. Error messages and/or full log output:
root@caddy:/var/log # ls -al
total 170
drwxr-xr-x 2 root wheel 30 Apr 28 03:01 .
drwxr-xr-x 24 root wheel 24 May 7 07:13 ..
-rw------- 1 root wheel 62 Apr 20 12:25 auth.log
-rw------- 1 root wheel 73029 May 7 07:22 cron
-rw------- 1 root wheel 7094 Apr 23 06:00 cron.0.bz2
-rw------- 1 root wheel 62 Apr 20 12:25 debug.log
-rw-r--r-- 1 root wheel 62 Apr 20 12:25 devd.log
-rw------- 1 root wheel 24699 Apr 28 03:01 dmesg.today
-rw------- 1 root wheel 21941 Apr 27 03:01 dmesg.yesterday
-rw-r--r-- 1 root wheel 62 Apr 20 12:25 lpd-errs
-rw-r----- 1 root wheel 5411 Apr 28 03:09 maillog
-rw-r----- 1 root wheel 1152 Apr 28 00:00 maillog.0.bz2
-rw-r----- 1 root wheel 937 Apr 27 00:00 maillog.1.bz2
-rw-r----- 1 root wheel 831 Apr 23 00:00 maillog.2.bz2
-rw-r----- 1 root wheel 633 Apr 22 00:00 maillog.3.bz2
-rw-r----- 1 root wheel 130 Apr 21 00:00 maillog.4.bz2
-rw-r--r-- 1 root wheel 6419 May 7 07:13 messages
-rw------- 1 root wheel 55 Apr 21 03:02 mount.today
-rw-r--r-- 1 root wheel 0 Apr 26 18:30 nextcloud_access.log
-rw-r--r-- 1 root wheel 0 Apr 26 18:30 nextcloud_errors.log
-rw-r----- 1 root network 62 Apr 20 12:25 ppp.log
-rw------- 1 root wheel 62 Apr 20 12:25 security
-rw-r----- 1 root wheel 0 Apr 27 14:00 sendmail.st
-rw-r----- 1 root wheel 0 Apr 27 14:00 sendmail.st.0
-rw-r----- 1 root wheel 0 Apr 20 14:00 sendmail.st.1
-rw------- 1 root wheel 3304 Apr 21 03:02 setuid.today
-rw------- 1 root wheel 315 Apr 20 12:46 userlog
-rw-r--r-- 1 root wheel 0 Apr 20 12:25 utx.lastlogin
-rw-r--r-- 1 root wheel 87 May 7 07:13 utx.log
-rw------- 1 root wheel 62 Apr 20 12:25 xferlog
root@caddy:/var/log #
May 7 07:13:07 caddy /usr/sbin/cron[57140]: (CRON) WARNING (madvise() failed)
May 7 07:15:14 caddy /usr/sbin/cron[57306]: (root) CMD (/usr/libexec/atrun)
May 7 07:20:02 caddy /usr/sbin/cron[57738]: (root) CMD (/usr/libexec/atrun)
May 7 07:22:00 caddy /usr/sbin/cron[57944]: (operator) CMD (/usr/libexec/save-entropy)
root@caddy:/var/log #
root@caddy:/var/log # cat messages
May 7 07:13:07 caddy syslogd: kernel boot file is /boot/kernel/kernel
root@caddy:/var/log #
5. What I already tried:
caddy -caddyfile-to-json
caddy -caddyfile-to-json -conf Caddyfile
caddy -caddyfile-to-json caddy.json -conf Caddyfile