explain what you are trying to do,
Trying to get my first caddy server setup but I keep getting a 502 error.
show what you have already tried,
I’ve been working on it for 2 days and still have no idea.
include error messages and log output,
Nov 23 05:43:51 ubuntu-s-1vcpu-1gb-nyc1-01 systemd[1]: Stopped blockchain-class.com app.
Nov 23 05:43:51 ubuntu-s-1vcpu-1gb-nyc1-01 systemd[1]: lenslocked.com.service: Scheduled restart job, restart counter is at 322.
Nov 23 05:43:51 ubuntu-s-1vcpu-1gb-nyc1-01 systemd[1]: lenslocked.com.service: Service hold-off time over, scheduling restart.
Nov 23 05:43:21 ubuntu-s-1vcpu-1gb-nyc1-01 systemd[1]: lenslocked.com.service: Failed with result 'exit-code'.
Nov 23 05:43:21 ubuntu-s-1vcpu-1gb-nyc1-01 systemd[1]: lenslocked.com.service: Main process exited, code=exited, status=203/EXEC
Nov 23 05:43:21 ubuntu-s-1vcpu-1gb-nyc1-01 systemd[2526]: lenslocked.com.service: Failed at step EXEC spawning /root/app/server: Permission denied
Nov 23 05:43:21 ubuntu-s-1vcpu-1gb-nyc1-01 systemd[2526]: lenslocked.com.service: Failed to execute command: Permission denied
and link to any relevant resources.
I can put file snippets here, if anyone wants to help please let me know what you want to see.
system: ubuntu 16.04, digital ocean droplet, Caddy 0.11.1 (non-commercial use only)
Here’s some information that would be helpful in determining the best way to troubleshoot the problem:
How did you install Caddy?
How do you run Caddy?
(e.g. systemd unit file, CLI command, flags & parameters, etc)
What’s your Caddyfile?
I’m not sure that your systemd logs relate to Caddy itself; although I note that apparently you’re another customer of @joncalhoun’s excellent course! Are you planning to use Caddy to proxy your lenslocked app?
Yes! I am working on @joncalhoun’s lenslocked tutorial. Have you done it? I have been wrestling with caddy for two days, i legit don’t know what I’m missing.
I installed caddy using the curl command.
During the tutorial I created a couple files, related to caddy and i believe one of them is the one firing it up each time.
[Unit]
Description=caddy server for server for lenslocked.blockchain-class.com
[Service]
WorkingDirectory=/root/app
ExecStart=/usr/local/bin/caddy -agree=true -email email@yasin.io
Restart=always
RestartSec=120
LimitNOFILE=8192
[Install]
WantedBy=multi-user.target
I have indeed! Multiple times, actually - I found it, personally, to be a very efficient teaching tool. Each subsequent time I did it I deviated from the book in some significant way and built on the knowledge. It helped me learn Go very quickly and quite a few general web development skills, too. Bought his second course as well, looking forward to starting that at some point. But you’re not here for a testimonial, you’re here to get your site online
Your configuration looks good to me. The problem I think might actually be with your lenslocked app. The fact that you’re seeing status 502 means Caddy received your request, tried to proxy it upstream, but didn’t get a response to give back to you, the client.
One quick way to test exactly what Caddy is seeing, when it proxies upstream for you, is to use curl. Try running this from a shell on the Caddy host: