Use http.browse with a domain

(Okeehou) #1

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. {
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

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

What should I do? Thanks!

(Toby Allen) #2

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

(Okeehou) #3

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 {
proxy / localhost:someport

https://sub2.mysite.domain {
proxy / localhost:someport

https://mysite.domain {
root /some/folder/wordpress
    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 /

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
  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'.

(Matt Holt) #4

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?

(Okeehou) #5

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.

(Abiola Ibrahim) #6

What is the output of journalctl -u caddy ?

(Okeehou) #7

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!

(system) #8

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