
Most people don’t set out to learn a new web server. They have a problem. Maybe an Nginx config has grown into 400 lines of copy-pasted location blocks. Maybe a Let’s Encrypt renewal cron job failed silently on a Sunday and a client’s site threw certificate warnings on Monday. Or maybe a side project needs HTTPS in the next ten minutes, and nobody wants to wire up Certbot, a deploy hook and a reload script to get there.
Caddy fixes that class of problem. It’s a single Go binary with sane defaults. It obtains and renews TLS certificates on its own, speaks HTTP/2 and HTTP/3 out of the box, and takes a configuration file that a person can read half asleep. Pair it with Fedora 45 and you get a modern kernel, current OpenSSL and systemd, SELinux enforcing by default, and firewalld already running. That combination is excellent for a production-grade edge server, but only if you respect the platform’s rules.
Fedora 45 shipped on November 3, 2026 and is supported until December 8, 2027 according to the release schedule. That is a short support window by enterprise standards, so plan your upgrade path early. This guide covers installation from both available sources, a working Caddyfile, firewall and SELinux handling, performance tuning, and the errors that actually show up in production.
Why Run Caddy on Fedora 45?
Fedora is not the usual choice for a long-lived production box. Many admins reach for AlmaLinux or Rocky Linux when they want a decade of stability. But Fedora earns its place in plenty of real setups: developer staging servers, personal VPS machines, internal tools, edge nodes that get rebuilt often, and labs where you want to see tomorrow’s RHEL behavior today.
Caddy suits these roles for a few practical reasons:
- Automatic HTTPS removes an entire category of operational chores. There is no separate ACME client to maintain.
- The configuration is compact. A reverse proxy with TLS is often three lines.
- Reloads are graceful. Active connections are not dropped when you apply a new config.
- The memory footprint is modest compared with a tuned Apache stack, and it scales across cores without extra worker tuning.
- Modern protocol support, including HTTP/3 over QUIC, is on by default.
There’s a trade-off worth admitting. Nginx still has a bigger ecosystem of third-party modules and years of tribal knowledge behind it. If your team already runs complex Lua or njs logic, migration is not free. For the majority of sites though (static content, PHP-FPM backends, Node or Python apps, internal dashboards), Caddy gets you to a secure and maintainable result sooner.
Before You Start: Prerequisites
A few minutes of preparation prevents most of the failures covered in the troubleshooting section later.
You need:
- A Fedora 45 system (Server, Workstation, or minimal install). Fedora Atomic desktops use a different host-package workflow and are not covered here.
- A user with
sudoprivileges. - A domain name with an A record (and AAAA if you use IPv6) pointing at the server’s public IP.
- Ports 80 and 443 reachable from the internet, plus UDP 443 if you want HTTP/3.
- No other service already bound to ports 80 or 443.
Check the system state first:
cat /etc/fedora-release
uname -r
sudo ss -tulpn | grep -E ':80|:443'
getenforce
sudo firewall-cmd --state
If ss prints anything, another web server is already listening. Stop it or move it before continuing. If getenforce returns Enforcing, good. Leave it that way. SELinux is a feature here, not an obstacle, and the sections below show how to work with it.
Update the system before you add new software:
sudo dnf upgrade --refresh -y
If the upgrade pulls in a new kernel, reboot now rather than discovering later that the running kernel and installed modules disagree.
Two Ways to Install Caddy on Fedora
Fedora 45 gives you two reasonable sources for the caddy package. Both use DNF and both install the same package name, so pick one and stay with it.
| Method | Source | Updates | Best fit |
|---|---|---|---|
| Fedora package | Fedora repositories | DNF, from Fedora | Systems that prefer Fedora-maintained packages |
| Upstream RPM | @caddy/caddy COPR | DNF, from the Caddy COPR | Systems that need the upstream project’s RPM build |
The Fedora package is the simplest path and keeps everything under Fedora’s own signing and update process. The COPR gives you the upstream project’s build, which usually tracks new Caddy releases faster. The Caddy documentation itself points Fedora users to the COPR.
One caution before you pick the COPR route. COPR repositories build for specific Fedora releases, and the chroot list can lag behind a brand-new Fedora version. At the time of checking, the project page listed builds for Fedora 40 through 43 in its release table. Always confirm that Fedora 45 appears as an available target before you rely on it. If it does not, the Fedora repository package is the safer choice, and a failed dnf copr enable will tell you quickly.
Method 1: Install Caddy from the Fedora Repositories
This is the one-liner:
sudo dnf install caddy
Confirm what you got:
rpm -q caddy
caddy version
The RPM release string includes the Fedora tag, something like .fc45.x86_64. That tells you the package was built for your release, which is exactly what you want.
Method 2: Install the Upstream Caddy RPM from COPR
Fedora ships DNF 5, and the copr subcommand lives in a plugin package. If dnf copr --help fails, install the plugin first:
sudo dnf install dnf5-plugins
Enable the repository and install:
sudo dnf copr enable @caddy/caddy
sudo dnf --refresh install caddy
DNF will show the repository’s signing key and ask you to confirm it. Read the fingerprint prompt rather than mashing y. The refresh flag matters on a fresh COPR enable, because it forces DNF to pull the new metadata before resolving the install.
If you are mixing sources (for example, Caddy was installed from Fedora and you later enable the COPR), check which repository wins:
dnf repoquery --installed caddy
dnf info caddy
Look at the “From repo” field. Surprises here cause confusing version mismatches during upgrades.
What the Package Actually Installs
It pays to know the layout before you touch anything. The package creates a dedicated caddy system user, installs the binary, and drops systemd units and a default config in place. The upstream RPM ships both of Caddy’s systemd service files but does not enable them by default.
| Item | Path |
|---|---|
| Binary | /usr/bin/caddy |
| Main config | /etc/caddy/Caddyfile |
| Service unit | caddy.service |
| Data directory (certs, OCSP) | /var/lib/caddy |
| Logs | journald, via journalctl -u caddy |
That “not enabled by default” detail trips up beginners. After install, nothing is running. Start it and enable it at boot:
sudo systemctl enable --now caddy
sudo systemctl status caddy --no-pager
Active and running? Good. Visit the server’s IP in a browser, and the default Caddy welcome page should load over HTTP.
If it fails here, jump to the troubleshooting section. Port conflicts and SELinux denials account for most first-run failures.
Open the Firewall Correctly
Fedora Server runs firewalld. A running Caddy that nobody can reach is a very common “it doesn’t work” report. Open the standard services:
sudo firewall-cmd --permanent --add-service=http
sudo firewall-cmd --permanent --add-service=https
sudo firewall-cmd --permanent --add-port=443/udp
sudo firewall-cmd --reload
sudo firewall-cmd --list-all
The UDP rule is the one people forget. HTTP/3 runs over QUIC, which uses UDP port 443. Without it, browsers quietly fall back to HTTP/2 over TCP. Nothing breaks, so nobody notices, but you lose the lower connection latency on flaky mobile networks.
Also check your cloud provider’s security group or network ACL. A perfect firewalld config means nothing when the VPS provider blocks port 443 upstream. This mistake is more common than it should be.
Your First Caddyfile
The default file at /etc/caddy/Caddyfile is a placeholder. Replace it with something real. Start with a static site:
sudo mkdir -p /var/www/example.com
echo '<h1>It works</h1>' | sudo tee /var/www/example.com/index.html
Now edit the config:
sudo nano /etc/caddy/Caddyfile
example.com, www.example.com {
root * /var/www/example.com
encode zstd gzip
file_server
header {
Strict-Transport-Security "max-age=31536000; includeSubDomains"
X-Content-Type-Options "nosniff"
X-Frame-Options "SAMEORIGIN"
Referrer-Policy "strict-origin-when-cross-origin"
}
log {
output file /var/log/caddy/example.com.log
format json
}
}
Before you apply it, validate and format:
sudo caddy fmt --overwrite /etc/caddy/Caddyfile
sudo caddy validate --config /etc/caddy/Caddyfile --adapter caddyfile
Then reload without dropping connections:
sudo systemctl reload caddy
Use reload, not restart, for config changes. Restart tears down the process, and any in-flight request during a traffic spike goes with it. Reload swaps configuration gracefully, and if the new config is invalid, Caddy keeps running the old one.
A note on the log block above: if you write to /var/log/caddy/, that directory must exist and be writable by the caddy user. Otherwise the service will fail at startup. Create it properly:
sudo mkdir -p /var/log/caddy
sudo chown caddy:caddy /var/log/caddy
sudo restorecon -Rv /var/log/caddy
The restorecon step applies the correct SELinux label. Many admins skip logging to files entirely and rely on journald, which is simpler and avoids this whole permission topic. For most servers that is the better default.
How Automatic HTTPS Really Works
When you put a real domain name in the Caddyfile, Caddy does several things on its own. It obtains a certificate from an ACME certificate authority, stores it under /var/lib/caddy, redirects HTTP to HTTPS, and renews the certificate well before expiry. No cron job. No hook script.
For that to work, three conditions must hold:
- The domain’s DNS must resolve to this server.
- Port 80 or 443 must be reachable from the public internet for the challenge.
- The
caddyuser must be able to write to its data directory.
Watch the first issuance happen:
sudo journalctl -u caddy -f
You should see lines about obtaining a certificate and then serving HTTPS. If you see challenge failures instead, check DNS and the firewall first. Let’s Encrypt applies rate limits to repeated failures, so do not hammer a broken setup for an hour. Fix the cause, then retry.
For development and staging, point Caddy at a test CA to avoid burning rate limits:
{
acme_ca https://acme-staging-v02.api.letsencrypt.org/directory
}
Remove it before going live. Browsers will not trust the staging certificates, which is the point.
For internal hosts that are not publicly reachable, such as a wildcard cert behind a private network, use the DNS challenge. That requires a Caddy build that includes your DNS provider’s plugin, which the stock package does not include. The section on custom builds below covers it.
Reverse Proxy Setup for Real Applications
Static files are the demo. Production usually means proxying to an application: Node, Django, Laravel behind PHP-FPM, Grafana, Gitea, whatever. The reverse proxy block is short:
app.example.com {
encode zstd gzip
reverse_proxy 127.0.0.1:3000 {
health_uri /healthz
health_interval 10s
header_up X-Real-IP {remote_host}
}
}
Caddy sets the standard forwarded headers by default. The health_uri lines are optional, but they matter once you have more than one backend.
Load Balancing Across Multiple Backends
app.example.com {
reverse_proxy 10.0.0.11:3000 10.0.0.12:3000 10.0.0.13:3000 {
lb_policy least_conn
lb_try_duration 5s
health_uri /healthz
health_interval 5s
fail_duration 30s
}
}
least_conn is a sensible default for apps with uneven request times. lb_try_duration lets Caddy retry another backend for a few seconds when one is down, so users see a slightly slower response instead of a 502.
PHP Sites with PHP-FPM
Install PHP-FPM from Fedora’s repositories:
sudo dnf install php-fpm php-mysqlnd php-opcache
sudo systemctl enable --now php-fpm
Fedora’s PHP-FPM listens on a Unix socket at /run/php-fpm/www.sock and runs the pool as apache by default. Caddy runs as caddy, so the socket permissions need adjusting. Edit /etc/php-fpm.d/www.conf:
user = caddy
group = caddy
listen.owner = caddy
listen.group = caddy
Restart PHP-FPM, then use this site block:
blog.example.com {
root * /var/www/blog
encode zstd gzip
php_fastcgi unix//run/php-fpm/www.sock
file_server
}
Mismatched socket ownership is the classic cause of a 502 on PHP sites. Check it first when you see one.
SELinux: Work With It, Not Against It
This is where Fedora differs most from a generic Ubuntu tutorial. SELinux in enforcing mode controls what the Caddy process can read, write and connect to. The most common advice online is “just set it to permissive.” Do not do that on a production server. Learn the three or four fixes that cover almost every case.
Serving Files From a Non-Standard Directory
Web content needs the right file context. If you create /srv/mysite and Caddy cannot read it, label it:
sudo semanage fcontext -a -t httpd_sys_content_t "/srv/mysite(/.*)?"
sudo restorecon -Rv /srv/mysite
If semanage is missing, install it:
sudo dnf install policycoreutils-python-utils
Binding to a Non-Standard Port
If you want Caddy to listen on 8080 or 8443, SELinux may block it unless the port is labeled:
sudo semanage port -a -t http_port_t -p tcp 8080
If the port is already defined under another type, use -m instead of -a.
Reverse Proxy Connection Denials
When Caddy proxies to a backend on a non-standard port and gets a “permission denied” error, the cause is usually a denied outbound connection. Check the audit log:
sudo ausearch -m avc -ts recent
sudo journalctl -t setroubleshoot --since "10 minutes ago"
A frequent fix for HTTP daemons that must connect to network backends is the following boolean:
sudo setsebool -P httpd_can_network_connect 1
Whether this applies depends on the SELinux domain the Caddy process actually runs in on your build, so read the AVC message before you flip anything. If the denial names httpd_t as the source, the boolean is the right tool. If it names something else, the fix is different. Reading the denial first is a habit that saves hours.
Avoid the lazy fix of generating a custom policy module from every denial without reading it. That is how a tight policy quietly becomes a loose one.
Security Hardening Beyond the Defaults
Caddy’s defaults are good. A production edge server deserves a bit more.
Run With Least Privilege
The packaged service already uses a dedicated unprivileged user. Verify it:
ps -o user,pid,cmd -C caddy
systemctl cat caddy | grep -E 'User|Group|Capabilit|NoNew|Protect'
The unit grants only the capability needed to bind low ports. Resist the urge to run Caddy as root “just to make it work.” Fix the permission problem instead.
Add Security Headers
The header block in the earlier example is a starting point. A Content-Security-Policy is worth the effort, but test it in report-only mode first, because a strict policy can break inline scripts or third-party widgets without warning.
Restrict Admin API Exposure
Caddy exposes an admin API, by default on localhost:2019. Leave it bound to localhost. If you do not need it, disable it:
{
admin off
}
Never expose that port to a network. It can change the running configuration.
Rate Limiting and Abuse Control
Stock Caddy does not include rate limiting. For public login forms or APIs, either add a rate limit module through a custom build, put a WAF or CDN in front, or pair Caddy with fail2ban reading the JSON access log. A simple approach many admins use is filtering at the firewall for obvious abusers, and handling application-level throttling inside the app itself.
Keep Patched
Fedora moves quickly, and so does Caddy. Turn on automatic security updates if the server is unattended:
sudo dnf install dnf5-plugin-automatic
sudo systemctl enable --now dnf5-automatic.timer
Review /etc/dnf/automatic.conf (or the drop-in under /etc/dnf/dnf5-plugins/) to decide whether updates should apply or just download. For critical systems, many admins prefer download-and-notify, then patch in a window. Remember the 13-month support window of Fedora 45, and schedule the next release upgrade before end of life.
Troubleshooting Common Caddy Errors on Fedora
Most Caddy problems on Fedora fall into a handful of buckets. Work through them in order.
Service Fails to Start: “address already in use”
Something else owns port 80 or 443. Often it is Apache (httpd) or Nginx left over from a previous experiment.
sudo ss -tulpn | grep -E ':80|:443'
sudo systemctl disable --now httpd nginx
sudo systemctl restart caddy
Service Fails to Start: Permission Denied on Config or Log File
Check ownership and SELinux context:
ls -lZ /etc/caddy/Caddyfile /var/log/caddy
sudo restorecon -Rv /etc/caddy /var/log/caddy
sudo ausearch -m avc -ts recent
Certificate Issuance Fails
Read the journal for the actual ACME error. The usual culprits:
- DNS does not point at this server yet (check with
dig +short example.com). - Port 80/443 is blocked by firewalld or the cloud provider.
- A CAA record forbids the chosen certificate authority.
- Rate limits were hit after repeated failures.
Fix the root cause and wait if you hit a limit. Do not keep restarting.
502 Bad Gateway
Caddy is up, but the backend isn’t answering. Test the upstream directly from the server:
curl -v http://127.0.0.1:3000/
sudo systemctl status your-app
If the backend works but Caddy cannot reach it, suspect SELinux (see the earlier section) or a socket permission mismatch for PHP-FPM.
403 Forbidden on Static Files
Almost always file permissions or SELinux labels. Check:
namei -l /var/www/example.com/index.html
ls -lZ /var/www/example.com
The caddy user needs execute permission on every directory in the path and read permission on the files. Files in a home directory are a common trap, since /home/user is typically mode 700.
Config Reload Does Nothing
Validate first. A syntax error means Caddy keeps the old config running. Also confirm you edited the file the service actually uses:
systemctl cat caddy | grep -i ExecStart
HTTP/3 Not Working
Check the UDP firewall rule, the cloud security group, and the kernel buffer warning described earlier. Some corporate networks also block UDP 443, which is outside your control.
“Too Many Open Files”
Raise LimitNOFILE using the drop-in shown in the performance section.