Reputation: 9484
No. 4 of this says
Take care of your statics and medias
Normally I takes care them by Nginx
in dev-server or S3/CloudFront
in prod-server. But this time I judge Caddy
is a webserver like Nginx
. Then I read on the DockerFile. But I couldn't find any example of them
Question:
My understanding is when I use Caddy
I have to use something else to serve statics and medias
.
Am I correct?
If not please show the reference then I will study further
Upvotes: 5
Views: 3195
Reputation: 5488
The new version of Caddy doesn't support except
directive.
You can serve static files like this:
domain.tld {
root /var/www/project/folder
handle {
reverse_proxy 127.0.0.1:8080
}
handle /static/* {
file_server
}
handle /media/* {
file_server
}
}
Upvotes: 0
Reputation: 953
According to caddy website it is able to serve static files. You can tell Caddy to serve static files by using except
keyword:
domain.tld {
root /var/www/project/folder
proxy / localhost:8000 {
transparent
except /static
}
}
Assuming that your static files are stored under /var/www/project/folder/static
, any url that begins with domain.tld/static/
should be served by Caddy server as static file.
Upvotes: 4