V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
Distributions
Ubuntu
Fedora
CentOS
中文资源站
网易开源镜像站
gxgxxn
V2EX  ›  Linux

Caddy 如何实现让不同的服务通过域名子目录的形式访问

  •  
  •   gxgxxn · 2021-09-27 12:09:51 +08:00 · 776 次点击
    这是一个创建于 939 天前的主题,其中的信息可能已经有所发展或是发生改变。

    如域名 example.com ,想要把网盘和 Caddy 的文件分享分别放在 example.com/panexample.com/file 下面,

    example.com {
            redir /pan /pan/
            handle_path /pan/* {
                  reverse_proxy 127.0.0.1:9000
            }
    
            redir /file /file/
            handle_path /file/* {
                  root * /shared/file/path/
                  file_server browse
            }
    }
    

    按上面这个配置,通过 example.com/file 可以正常访问文件分享服务,而 example.com/pan 只有首页可以访问,其他页面或资源不能正常访问,其路径依然 example.com/*,而不是 example.com/pan/*。

    paradox2023
        1
    paradox2023  
       165 天前
    我也遇到相同问题了,楼主解决了么。
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   5639 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 31ms · UTC 03:17 · PVG 11:17 · LAX 20:17 · JFK 23:17
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.