发现一个最简单的免费部署纯静态网站的方法: surge.sh - V2EX
V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
请不要在回答技术问题时复制粘贴 AI 生成的内容
terryso
0.6D
0.57D
V2EX    程序员

发现一个最简单的免费部署纯静态网站的方法: surge.sh

  •  
  •   terryso
    terryso 79 天前 4534 次点击
    这是一个创建于 79 天前的主题,其中的信息可能已经有所发展或是发生改变。

    只需两行命令,就能把你的静态网站发布到线上,还支持自定义域名和免费 SSL 。对于个人项目来说,简直是神器!

    # 全局安装 surge 包
    npm install --global surge

    # 进入的你项目目录
    surge

    传送门: https://surge.sh/
    38 条回复    2025-09-22 18:08:56 +08:00
    chnwine
        1
    chnwine  
       79 天前   2
    我之前用 http://vercel.com/,后来把东西都托管在 https://www.cloudflare.com/ 上之后,现在都想给 cloudflare 磕一个,太懂开发者的心了
    terryso
        2
    terryso  
    OP
       79 天前
    @chnwine cloudflare 我也有在用, 的确很好, 免费额度也足够. 不过如果只是想简单部署一个静态网页展示某些东西, 还是这个简单
    Magicdove
        3
    Magicdove  
       79 天前
    确实简单高效
    WizardLeo
        4
    WizardLeo  
       79 天前
    @chnwine github 仓库+cloudflare page ,完美的静态网站解决方案。
    tidos
        5
    tidos  
       79 天前
    很早之前用 s3 和 github 部署过静态网页
    putaozhenhaochi
        6
    putaozhenhaochi  
       79 天前
    记得它之前是被墙掉的.
    terryso
        7
    terryso  
    OP
       79 天前
    @putaozhenhaochi 你都能上 v 站了, 还怕被墙吗?
    phithon
        8
    phithon  
       79 天前
    @terryso 网站又不是给自己看的。。。
    terryso
        9
    terryso  
    OP
       79 天前
    @phithon 你无论用 https://vercel.com/ 还是 https://www.cloudflare.com/ 都是有类似的问题的. 一般用这种国外服务的都是默认用户或者客户能翻墙的.
    csfreshman
        10
    csfreshman  
       79 天前
    @chnwine vercel 没绑定域名,有时候必须要挂梯子才能访问,老哥有遇到过吗?
    csfreshman
        11
    csfreshman  
       79 天前
    @terryso #9 vercel 搭建的网站,默认被墙吗?难怪我有时候打不开,梯子换下节点又 ok 了
    terryso
        12
    terryso  
    OP
       79 天前
    @csfreshman 外国的服务都这样的, 你就默认当需要挂梯子才能访问吧. 如果你服务的用户大部分在国内, 还是用国内的云服务吧.
    csfreshman
        13
    csfreshman  
       79 天前
    vercel 还有类似竞品 netxxx ,其实都无脑简单(如果不追求自己 diy 主题),点点点,会提交到 github 就行了,自动构建发布,周末刚体验了下, 就是要翻墙才能看,一下子浏览量就下降很多
    terryso
        14
    terryso  
    OP
       79 天前
    @csfreshman 是的, 如果你的项目不是出海项目, 还是老老实实用国内的云服务吧
    csfreshman
        15
    csfreshman  
       79 天前
    @terryso #14 就是个笔记,体验了下,内容提交到 github ,vercel 自动构建发布,有点类似 cicd ,挺方便,缺点就是国内访问问题,可以接受,慢慢迁过去了
    terryso
        16
    terryso  
    OP
       79 天前
    @csfreshman 嗯, 是的, 用国外免费服务就是要接受这一点限制.
    chnwine
        17
    chnwine  
       79 天前 via Android
    @csfreshman 好像是有这种问题,但我的环境更扯,github 有时候要自己手机开热点然后开梯子才能用,所以大部分时候都挂着梯子了
    chnwine
        18
    chnwine  
       79 天前 via Android
    @WizardLeo 非常完美,私有仓库 cf 也能自动触发部署。

    唯一缺点的是我的环境有时候挂着梯子 git push 都费劲,于是有一部分仓库我用的是 bitbucket
    terryso
        19
    terryso  
    OP
       79 天前
    @chnwine 我是一直挂梯子, 用规则区分国内和国外网站
    JoeJoeJoe
        20
    JoeJoeJoe  
    PRO
       79 天前
    https://edgeone.ai/ 不是有免费的么? 国内也能访问
    xinzhanghello
        21
    xinzhanghello  
       79 天前
    @chnwine cf 无敌,用完后,就去买的股票,现在都够我无限 subscribe 服务的了
    chnwine
        22
    chnwine  
       79 天前
    @xinzhanghello 大佬优秀啊,直接成为投资人
    cwwx2022
        23
    cwwx2022  
       79 天前
    @xinzhanghello 大佬牛逼,直接入股,哈哈哈
    csfreshman
        24
    csfreshman  
       79 天前
    @chnwine #17 github 这个不稳定,这个我理解 private 仓库只是自己备份笔记,对外展示时还是 vercel 的锅,绑定自己的域名应该可以解决?
    @terryso #16
    liuliuliuliu
        25
    liuliuliuliu  
    PRO
       79 天前
    @csfreshman #11 vercel 是可以不被墙的,只要绑定自己的域名就行
    csfreshman
        26
    csfreshman  
       79 天前
    @liuliuliuliu 好,感谢,我把博客搬的差不多,就改下域名
    chnwine
        27
    chnwine  
       79 天前
    @csfreshman 我试 git push 推不上去,push 不上去就触发不了自动部署,不是后半部分构建、访问的问题 。
    mokecc
        28
    mokecc  
       79 天前
    还是老老实实放在国内的对象存储上吧
    我是放在阿里云的 oss 上,再加上 cdn 加速,毫秒级的相应
    skiy
        29
    skiy  
       79 天前
    早就知道了。BUT ,它不支持自有域名 + https
    terryso
        30
    terryso  
    OP
       79 天前
    @skiy 现在都支持了
    skiy
        31
    skiy  
       79 天前
    @terryso 你试试看。我之前部署了但证书一直没能更新。
    z1gui
        32
    z1gui  
       79 天前
    想知道这种和 hexo ,docsify ,Vuepress 那种静态的文件+github Page 发布有啥区别呢
    terryso
        33
    terryso  
    OP
       78 天前 via iPhone
    @skiy ssl 没试过,但自定义域名是可以的
    soseek
        34
    soseek  
       78 天前 via iPhone
    @skiy 交钱就可以啦
    rmrf
        35
    rmrf  
       78 天前
    这个跟 vercel 比如何啊?
    terryso
        36
    terryso  
    OP
       78 天前
    @rmrf 这个简单
    onebitbank
        37
    onebitbank  
       23 天前
    @terryso 为什么我用 surge 部署后不配置自定义域名,过几个小时,网站就无法访问了
    onebitbank
        38
    onebitbank  
       23 天前
    不是被墙,是 surge 提示网站 unavaiable
    关于     帮助文档     自助推广系统     博客     API     FAQ     Solana     3129 人在线   最高记录 6679       Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 27ms UTC 11:50 PVG 19:50 LAX 04:50 JFK 07:50
    Do have faith in what you're doing.
    ubao snddm index pchome yahoo rakuten mypaper meadowduck bidyahoo youbao zxmzxm asda bnvcg cvbfg dfscv mmhjk xxddc yybgb zznbn ccubao uaitu acv GXCV ET GDG YH FG BCVB FJFH CBRE CBC GDG ET54 WRWR RWER WREW WRWER RWER SDG EW SF DSFSF fbbs ubao fhd dfg ewr dg df ewwr ewwr et ruyut utut dfg fgd gdfgt etg dfgt dfgd ert4 gd fgg wr 235 wer3 we vsdf sdf gdf ert xcv sdf rwer hfd dfg cvb rwf afb dfh jgh bmn lgh rty gfds cxv xcv xcs vdas fdf fgd cv sdf tert sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf shasha9178 shasha9178 shasha9178 shasha9178 shasha9178 liflif2 liflif2 liflif2 liflif2 liflif2 liblib3 liblib3 liblib3 liblib3 liblib3 zhazha444 zhazha444 zhazha444 zhazha444 zhazha444 dende5 dende denden denden2 denden21 fenfen9 fenf619 fen619 fenfe9 fe619 sdf sdf sdf sdf sdf zhazh90 zhazh0 zhaa50 zha90 zh590 zho zhoz zhozh zhozho zhozho2 lislis lls95 lili95 lils5 liss9 sdf0ty987 sdft876 sdft9876 sdf09876 sd0t9876 sdf0ty98 sdf0976 sdf0ty986 sdf0ty96 sdf0t76 sdf0876 df0ty98 sf0t876 sd0ty76 sdy76 sdf76 sdf0t76 sdf0ty9 sdf0ty98 sdf0ty987 sdf0ty98 sdf6676 sdf876 sd876 sd876 sdf6 sdf6 sdf9876 sdf0t sdf06 sdf0ty9776 sdf0ty9776 sdf0ty76 sdf8876 sdf0t sd6 sdf06 s688876 sd688 sdf86