Getting it to work

running on Ubuntu, I’ve followed the directions in the init/linux-systemd readme. the Caddyfile I created consists of the following:

root /var/www/prj/

and I have an index.html in the aforementioned directory. when I try to access the site with my browser I get a 404 Not Found.

I am expecting caddy to serve /var/www/prj/index.html on port 80 but it fails. what am I missing?

Could be a few things. Does the user running Caddy (www-data, probably, if you’re using systemd) have read access to the file?

Are you accessing it via http://localhost/ in your browser, as opposed to the IP or perhaps an external address?

Try setting up some logging by adding log stdout and errors stdout to your Caddyfile, then try the website a few times and go have a look at the output of journalctl -f -u caddy.service.

1 Like

thanks for the reply. I don’t recall now what the issue was but I did get it to work… however, when I attempt to look at the logs I get something like:

# journalctl -f -u caddy
-- Logs begin at Sat 2016-12-24 17:29:09 PST. --

and as I make requests I never get any output. the systemd file I’m using declares:

ExecStart=/usr/local/bin/caddy -log stdout -agree=true -conf=/etc/caddy/Caddyfile -root=/var/tmp

and I noticed you mention errors stdout, which I don’t find in the manuals. what else do I need?

Using the -log stdout parameter for the CLI specifies the startup logging. That’s all you need in the startup command.

Put log stdout and errors stdout in your Caddyfile for vhost-specific request and error logging. See log and errors docs.

ah! right. thank you!

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