V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
rivercherdeeeeee
V2EX  ›  程序员

只访问特定的资源目录

  •  
  •   rivercherdeeeeee · 217 天前 · 712 次点击
    这是一个创建于 217 天前的主题,其中的信息可能已经有所发展或是发生改变。
    PHP 做的一个网站,网站已经迁移到 shopify 上了,vps 上网站的所有代码和文件资源都没动,现在打算 shopify 上网站的图片还是用先前 vps 服务器上的图片资源,所以现在想配一个二级域名,比如,source.test.com 指向原来 vps 上的项目文件,但这个 source.test.com 只给访问原先 vps 上网站特定的图片资源,比如 https://source.test.com/themes/default-bootstrap/img/compare/new-and-improved.png 浏览打开 source.test.com 时则只显示 ok ,这种需求该如何实现
    3 条回复    2023-10-08 17:17:11 +08:00
    retanoj
        1
    retanoj  
       217 天前
    vps 上 nginx 配置个
    server {

    server_name source.test.com;

    location /themes {} 指向图片目录
    location / { return 200 "ok"; }

    }
    rivercherdeeeeee
        2
    rivercherdeeeeee  
    OP
       217 天前
    @retanoj .htaccess 里面该如何配置呀
    cpyun
        3
    cpyun  
       216 天前
    @rivercherdeeeeee .htaccess 就用 apache 的反向代理进行配置
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   2680 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 04:39 · PVG 12:39 · LAX 21:39 · JFK 00:39
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.