1. Caddy version (caddy version
):
2. How I run Caddy:
v2.3.0 h1:fnrqJLa3G5vfxcxmOH/+kJOcunPLhSBnjgIvjXV/QTA=
a. System environment:
Ubuntu 20.04 with systemd
b. Command:
systemctl start caddy
c. Service/unit/compose file:
N/A
d. My complete Caddyfile or JSON config:
{
experimental_http3
admin off
}
(logging) {
log {
output file /var/log/caddy/caddy.log {
roll_size 1gb
roll_keep 5
}
}
}
(errors) {
handle_errors {
root * /var/www/internal/errors
rewrite * /{http.error.status_code}.html
file_server
}
}
(php) {
php_fastcgi unix//run/php/php7.4-fpm.sock
}
www.telesphoreo.me {
import logging
redir https://telesphoreo.me{uri}
}
telesphoreo.me {
import logging
import errors
import php
root * /var/www/telesphoreo.me
file_server browse
encode gzip zstd
respond /assets/ 403
respond /files/ 403
respond /files/theme/ 403
respond /files/theme/fonts/ 403
respond /files/theme/images/ 403
respond /uploads/2/6/3/9/26395298/ 403
respond /uploads/2/6/3/9/26395298/background-images/ 403
respond /nitrogen/ 403
respond /wave/ 403
}
db.telesphoreo.me {
import logging
import php
root * /usr/share/phpmyadmin
file_server
}
forums.telesphoreo.me {
import logging
import php
file_server
root * /var/www/forums.telesphoreo.me/public
header /assets {
+Cache-Control "public, must-revalidate, proxy-revalidate"
+Cache-Control "max-age=25000"
Pragma "public"
}
encode gzip
}
i.telesphoreo.me {
import logging
import errors
root * /var/www/i.telesphoreo.me
file_server
}
panel.telesphoreo.me {
import logging
import php
root * /var/www/pterodactyl/public
file_server
header X-Content-Type-Options nosniff;
header X-XSS-Protection "1; mode=block";
header X-Robots-Tag none;
header Content-Security-Policy "frame-ancestors 'self'";
header X-Frame-Options DENY;
header Referrer-Policy same-origin;
request_body {
max_size 100m
}
respond /.ht* 403
}
updater.telesphoreo.me {
import logging
import errors
root * /var/www/updater.telesphoreo.me
file_server browse
}
packs.smokes-crystal.rocks {
import logging
redir https://i.telesphoreo.me{uri}
}
smokes-crystal.rocks {
import logging
import errors
root * /var/www/smokes-crystal.rocks
file_server
}
always-loses.net {
import logging
import errors
root * /var/www/html
file_server
}
www.always-loses.net {
import logging
redir https://always-loses.net{uri}
}
3. The problem I’m having:
I’m trying to run Pterodactyl (https://pterodactyl.io) natively with Caddy. They only have webserver configurations (Webserver Configuration | Pterodactyl) for Apache and Nginx, but nowhere does it say it doesn’t work with Caddy. I used to have Apache installed and reverse proxy Apache right to Caddy. Problem is that it’s slow! If you look at the panel.telesphoreo.me block, you’ll see what I have to try and get it working. My initial plan was to build Caddy with the nginx converter and convert a working Nginx conf with the Pterodactyl stuff right into Caddy’s format. For some reason, it wouldn’t convert anything. It said unrecognized directive for pretty much everything in the file. So, I tried doing it by hand. I cut out the first server block which is just a redirect for HTTPS. I also got rid of the SSL stuff because Caddy does that automatically. I also deleted all the PHP FastCGI stuff and just use the one liner that Caddy has. I also tried to copy the headers from the Nginx config to Caddy. It’s not throwing any errors so I assume those are fine.
Anyways, that leaves me with a panel that almost works. Basically, everything on the frontend works, but not on the backend. Some pages return error 500 for a reason that I can’t pin down. Here’s a video demonstrating it:
https://telesphoreo.me/2020-12-31%2021-48-47.mp4
As you can see, almost all of it loads just fine except for a few select pages. This doesn’t happen on Apache. I figured I’d ask here for ideas first because I’ve never previously had luck with Pterodactyl’s support.
4. Error messages and/or full log output:
Here are the relevant logs from my Caddy log
https://telesphoreo.me/caddy.log (external due to how large it is)
I’m not sure as those logs are pretty generic. I also tried running Wings (the daemon) in debug mode. These were the logs
INFO: [Dec 31 22:01:44.738] writing log files to disk path=/var/log/pterodactyl/wings.log
INFO: [Dec 31 22:01:44.739] loading configuration from path path=/etc/pterodactyl/config.yml
DEBUG: [Dec 31 22:01:44.739] running in debug mode
INFO: [Dec 31 22:01:44.740] configured wings with system timezone timezone=Etc/UTC
DEBUG: [Dec 31 22:01:44.740] ensuring root data directory exists path=/var/lib/pterodactyl
DEBUG: [Dec 31 22:01:44.740] ensuring server data directory exists path=/var/lib/pterodactyl/volumes
DEBUG: [Dec 31 22:01:44.741] ensuring archive data directory exists path=/var/lib/pterodactyl/archives
DEBUG: [Dec 31 22:01:44.741] ensuring backup data directory exists path=/var/lib/pterodactyl/backups
INFO: [Dec 31 22:01:44.742] checking for pterodactyl system user username=pterodactyl
INFO: [Dec 31 22:01:44.742] configured system user successfully gid=996 uid=996 username=pterodactyl
INFO: [Dec 31 22:01:44.743] fetching list of servers from API
DEBUG: [Dec 31 22:01:44.743] making request to external HTTP endpoint endpoint=https://panel.telesphoreo.me/api/remote/servers?per_page=50 headers=map[Accept:[application/vnd.pterodactyl.v1+json] Authorization:[Bearer Ff8LtAel(redacted)] Content-Type:[application/json] User-Agent:[Pterodactyl Wings/v1.2.0 (id:Ff8LtAelviPCoE4C)]] method=GET
INFO: [Dec 31 22:01:44.890] processing servers returned by the API total_configs=3
DEBUG: [Dec 31 22:01:44.891] using 4 workerpools to instantiate server instances
INFO: [Dec 31 22:01:44.891] creating new server object from API response server=c49b6b11-86fc-46ea-b581-06010df6782a
INFO: [Dec 31 22:01:44.891] creating new server object from API response server=7813b078-34e5-485d-a4d5-d1ee67e9a34c
INFO: [Dec 31 22:01:44.891] creating new server object from API response server=4a1a25eb-6ebf-4cbe-969a-058cd656f521
INFO: [Dec 31 22:01:44.892] registering event listeners: console, state, resources... server=7813b078-34e5-485d-a4d5-d1ee67e9a34c
INFO: [Dec 31 22:01:44.893] registering event listeners: console, state, resources... server=c49b6b11-86fc-46ea-b581-06010df6782a
INFO: [Dec 31 22:01:44.893] registering event listeners: console, state, resources... server=4a1a25eb-6ebf-4cbe-969a-058cd656f521
DEBUG: [Dec 31 22:01:44.894] syncing stop configuration with configured docker environment server=7813b078-34e5-485d-a4d5-d1ee67e9a34c
DEBUG: [Dec 31 22:01:44.894] syncing stop configuration with configured docker environment server=c49b6b11-86fc-46ea-b581-06010df6782a
DEBUG: [Dec 31 22:01:44.895] syncing stop configuration with configured docker environment server=4a1a25eb-6ebf-4cbe-969a-058cd656f521
INFO: [Dec 31 22:01:44.896] finished processing server configurations duration=6.326465ms
INFO: [Dec 31 22:01:44.906] loaded configuration for server server=7813b078-34e5-485d-a4d5-d1ee67e9a34c
INFO: [Dec 31 22:01:44.907] loaded configuration for server server=4a1a25eb-6ebf-4cbe-969a-058cd656f521
INFO: [Dec 31 22:01:44.908] loaded configuration for server server=c49b6b11-86fc-46ea-b581-06010df6782a
INFO: [Dec 31 22:01:44.908] configuring server environment and restoring to previous state server=4a1a25eb-6ebf-4cbe-969a-058cd656f521
INFO: [Dec 31 22:01:44.909] configuring server environment and restoring to previous state server=c49b6b11-86fc-46ea-b581-06010df6782a
INFO: [Dec 31 22:01:44.909] configuring server environment and restoring to previous state server=7813b078-34e5-485d-a4d5-d1ee67e9a34c
INFO: [Dec 31 22:01:44.914] detected server is running, re-attaching to process... server=4a1a25eb-6ebf-4cbe-969a-058cd656f521
DEBUG: [Dec 31 22:01:44.916] saw server status change event server=4a1a25eb-6ebf-4cbe-969a-058cd656f521 status=running
INFO: [Dec 31 22:01:44.919] configuring internal webserver host_address=0.0.0.0 host_port=8080 use_auto_tls=false use_ssl=true
INFO: [Dec 31 22:01:44.921] sftp subsystem listening for connections host=0.0.0.0 port=2022
DEBUG: [Dec 31 22:01:44.921] starting resource polling for container container_id=4a1a25eb-6ebf-4cbe-969a-058cd656f521
DEBUG: [Dec 31 22:01:49.950] GET /api/system client_ip=144.217.6.26 latency=211.654µs status=200
DEBUG: [Dec 31 22:01:53.468] GET /api/servers/7813b078-34e5-485d-a4d5-d1ee67e9a34c client_ip=144.217.6.26 latency=134.275µs status=200
DEBUG: [Dec 31 22:01:53.475] GET /api/servers/c49b6b11-86fc-46ea-b581-06010df6782a client_ip=144.217.6.26 latency=17.617µs status=200
DEBUG: [Dec 31 22:01:53.517] GET /api/servers/4a1a25eb-6ebf-4cbe-969a-058cd656f521 client_ip=144.217.6.26 latency=44.08µs status=200
DEBUG: [Dec 31 22:01:55.896] OPTIONS /api/system client_ip=70.37.246.22 latency=869ns status=200
DEBUG: [Dec 31 22:01:55.957] GET /api/system client_ip=70.37.246.22 latency=90.763µs status=200
DEBUG: [Dec 31 22:01:56.618] GET /api/system client_ip=144.217.6.26 latency=43.68µs status=200
As you can see, they’re pretty useless as I don’t get any error 500 codes. I also don’t seem to get any logs from Pterodactyl itself.
5. What I already tried:
The obvious solution would be to switch back to reverse proxying Apache. I’ve tried to convert the Nginx example to Caddy as best to my ability. I also tried a minimal server config with just the root, php, etc. and no headers or denying .ht* files. I’m also multitasking in the Pterodactyl discord seeing if I can get support. I’ve never had luck there, but I’m trying regardless. Note that I tried to copy the try_files from the Nginx config (replacing the $url with {path} and $query with {query}). That actually broke certain things like searching for a user to make an owner of a server. It also didn’t make any of the errors go away. Not sure what that’s there for exactly or if I did it wrong either. It was
try_files {path} {path}/ /index.php?{query}
6. Links to relevant resources:
(Error logging that Pterodactyl makes you do, but doesn’t have anything relating to Caddy / error 500)
https://bin.ptdl.co/zyt64/
https://ptero.co/oxaqowiham