Caddy is web server that process requests via HTTP but with a complete different goal from other webservers like Apache, Nginx, or lighttpd. Caddy’s primary goal is to be an easy-to-use static file web server so that anyone can host their own websites even with minimal technical knowledge.It is the only web server to serve all live sites over HTTPS by default (with some conditions provided) which is pretty cool.
caddy -conf=’path/to/caddyfile’
If your website is not in the path of caddy, give the path to your website using `root`
caddy -root=’path/to/website’
To clean your URL and add `ext` to your caddy file
ext .html
To reverse Proxy it to some other port
proxy / http://redirect_url {}
To log the error occurred and show the custom error page
errors {
log ../errors.log # Error log
404 error-404.html # Custom error page
}
status 404 /secrets
After all these changes, our caddyfile will look like following:
localhost #server address
proxy / http://localhost:8000 {}
ext .html # Clean URLs
errors {
log ../errors.log # Error log
404 error-404.html # Custom error page
}
status 404 /secrets