hzb
(Bin Hua)
September 24, 2021, 12:00am
1
1. Caddy version (caddy version
):
v2.4.5
I want to set a subpath like in Nginx
in Nginx
server {
listen 443;
server_name caddys.com;
ssl on;
root /root/blog;
//ssl configuration
location /books/ {
root /root/books;
index index.htm index.html;
}
}
How can I do the following part in Caddyfile?
location /books/ {
root /root/books;
index index.htm index.html;
}
Thank you so much.
hzb
(Bin Hua)
September 24, 2021, 12:24am
2
I checked help docs, I should use proxy.
Sorry to trouble.
You can use the handle_path
directive for this:
example.com {
handle_path /books* {
root * /root/books
file_server
}
handle {
root * /root/blog
file_server
}
}
Next time, please completely fill out the help topic template. Don’t delete any sections. It’s important to save time, and to avoid making us make assumptions about your setup.
1 Like
hzb
(Bin Hua)
September 24, 2021, 9:50am
4
I see, thank you so much.
1 Like
system
(system)
Closed
October 24, 2021, 12:01am
5
This topic was automatically closed after 30 days. New replies are no longer allowed.