Use http.browse with a domain

Hello, I got a problem when config http.browser with a domain name.

I us this config in Caddyfile and I can access my folder on web.

http://0.0.0.0.:12345 {
root /some/folder
browse /files
}

But if I use the below config, and restart caddy, it failed to restart.

https://mysites.domain {
root /some/folder
browse /files
gzip
tls myemail@myemail.com
}

I want to use my domain with https instead of IP:Port to access the folder.

What should I do? Thanks!

Is this your full caddyfile?
What version of caddy are you using?

What error did you get when it failed to start?

Use -log /somefile.log or -log stdout on the command line to get a system log

2 Likes

Thank you for replying me.

My caddy version:

root@aaaaaa:~# caddy -version
Caddy 0.10.10 (non-commercial use only)

My full caddyfile:

root@aaaaaa:~# cat /etc/caddy/Caddyfile
https://sub1.mysite.domain {
gzip
proxy / localhost:someport
tls email@email.com
}

https://sub2.mysite.domain {
gzip
proxy / localhost:someport
tls email@email.com
}

https://mysite.domain {
tls email@email.com
root /some/folder/wordpress
gzip
    fastcgi / /run/php/php7.0-fpm.sock php
    rewrite {
        if {path} not_match ^\/wp-admin
        to {path} {path}/ /index.php?_url={uri}
    }
}

#http://IP:Port {
#root /some/folder2/files
#browse /
#}

https://sub3.mysite.domain {
root /some/folder2/files
browse /
gzip
tls email@email.com
}

I ran systemctl restart caddy and get this:

root@aaaaaa:~# systemctl status caddy
● caddy.service - Caddy HTTP/2 web server
   Loaded: loaded (/etc/systemd/system/caddy.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Tue 2018-04-17 22:11:08 EDT; 5min ago
     Docs: https://caddyserver.com/docs
  Process: 29671 ExecStart=/usr/local/bin/caddy -log stdout -agree=true -conf=/etc/caddy/Caddyfile -root=/var/tmp (code=exited, status=1/FAILURE)
 Main PID: 29671 (code=exited, status=1/FAILURE)

Apr 17 22:11:08 aaaaaa systemd[1]: Started Caddy HTTP/2 web server.
Apr 17 22:11:08 aaaaaa systemd[1]: caddy.service: Main process exited, code=exited, status=1/FAILURE
Apr 17 22:11:08 aaaaaa systemd[1]: caddy.service: Unit entered failed state.
Apr 17 22:11:08 aaaaaa systemd[1]: caddy.service: Failed with result 'exit-code'.

We’re looking for Caddy’s logs, not systemd’s (as usual, systemd is getting in the way and not being helpful and possibly contributing to the problem). What’s in the Caddy log?

I beg your pardon, but it seems that I could not find any Caddy logs elsewhere. I use log /var/log/caddy-err.log but it failed to restart Caddy so there is no log being written. Would you mind to show me how to get these logs? Thanks.

What is the output of journalctl -u caddy ?

Sorry, my issue has been resolved. It seems something wrong with the old caddy version (same here), and I was rate limited cuz I tried to many times. I upgrade to v0.10.14 now, and the issue was fixed. Thank you guys for helping me!

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.