wobuhuicode
V2EX  ›  Node.js

nginx 配置了静态资源, NODE 项目里面如何使用?

  •  
  •   wobuhuicode · Mar 17, 2016 · 4913 views
    This topic created in 3736 days ago, the information mentioned may be changed or developed.
    前端转好后台,用 express 做的,以前把静态文件直接放到七牛去,在页面直接引用相应的 CSS 和 image 。后来使用了 nginx 的时候看到有静态资源配置,没看懂如果我在 nginx 配置了,那么页面里面引用的地址怎么写?
    4 replies    2016-03-20 11:28:38 +08:00
    cyberdak
        1
    cyberdak  
       Mar 17, 2016
    直接用七牛的地址就行了
    nginx 不用配置
    xl0shk
        2
    xl0shk  
       Mar 18, 2016
    所有资源都可以从 Nodejs 取, Nginx 在前端缓存静态资源就可以了
    wobuhuicode
        3
    wobuhuicode  
    OP
       Mar 19, 2016
    @cyberdak 嗯~那么这两种方式哪种比较好?
    cyberdak
        4
    cyberdak  
       Mar 20, 2016
    @wobuhuicode 看你需求啊,访问量大,需要 cdn 就丢七牛,这会产生 cdn 费用。

    项目随便自己人玩玩的话,就放 nginx 。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3771 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 33ms · UTC 00:18 · PVG 08:18 · LAX 17:18 · JFK 20:18
    ♥ Do have faith in what you're doing.