问题描述
我正在开发一个项目,该项目使用 caddy 作为 Web 服务器和代理,使用 django 作为后端,使用 gunicorn 作为 wsgi。 但一切正常,除了我无法提供静态文件。
这是我的 Caddyfile。
mydomain.com {
root * /path/to/staticfile/
file_server
encode zstd gzip
@notstatic {
not path /path/to/staticfile/*
}
reverse_proxy @notstatic app:8000
}
我用的有什么问题吗?
解决方法
如何去掉 @notstatic
,即:
mydomain.com {
root * /path/to/staticfile/
file_server
encode zstd gzip
reverse_proxy app:8000
}