• 请不要在回答技术问题时复制粘贴 AI 生成的内容
terryso
0.62D
0.7D
V2EX  ›  程序员

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

  •  
  •   terryso ·
    terryso · Jul 27, 2025 · 6761 views
    This topic created in 465 days ago, the information mentioned may be changed or developed.

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

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

    # 进入的你项目目录
    surge

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

    唯一缺点的是我的环境有时候挂着梯子 git push 都费劲,于是有一部分仓库我用的是 bitbucket
    terryso
    terryso
    OP
    Jul 28, 2025
    19
    @chnwine 我是一直挂梯子, 用规则区分国内和国外网站
    JoeJoeJoe
    JoeJoeJoe
    Jul 28, 2025
    20
    https://edgeone.ai/ 不是有免费的么? 国内也能访问
    xinzhanghello
    xinzhanghello
    Jul 28, 2025
    21
    @chnwine  cf 无敌,用完后,就去买的股票,现在都够我无限 subscribe 服务的了
    chnwine
    chnwine
    Jul 28, 2025
    22
    @xinzhanghello 大佬优秀啊,直接成为投资人😂
    cwwx2022
    cwwx2022
    Jul 28, 2025
    23
    @xinzhanghello 大佬牛逼,直接入股,哈哈哈
    csfreshman
    csfreshman
    Jul 28, 2025
    24
    @chnwine #17 github 这个不稳定,这个我理解 private 仓库只是自己备份笔记,对外展示时还是 vercel 的锅,绑定自己的域名应该可以解决?
    @terryso #16
    liuliuliuliu
    liuliuliuliu
    Jul 28, 2025
    25
    @csfreshman #11 vercel 是可以不被墙的,只要绑定自己的域名就行
    csfreshman
    csfreshman
    Jul 28, 2025
    26
    @liuliuliuliu 好,感谢,我把博客搬的差不多,就改下域名
    chnwine
    chnwine
    Jul 28, 2025
    27
    @csfreshman 我试 git push 推不上去,push 不上去就触发不了自动部署,不是后半部分构建、访问的问题 😂。
    mokecc
    mokecc
    Jul 28, 2025
    28
    还是老老实实放在国内的对象存储上吧
    我是放在阿里云的 oss 上,再加上 cdn 加速,毫秒级的相应😜
    skiy
    skiy
    Jul 28, 2025
    29
    早就知道了。BUT ,它不支持自有域名 + https
    terryso
    terryso
    OP
    Jul 28, 2025
    30
    @skiy 现在都支持了
    skiy
    skiy
    Jul 28, 2025
    31
    @terryso 你试试看。我之前部署了但证书一直没能更新。
    z1gui
    z1gui
    Jul 28, 2025
    32
    想知道这种和 hexo ,docsify ,Vuepress 那种静态的文件+github Page 发布有啥区别呢
    terryso
    terryso
    OP
    Jul 28, 2025 via iPhone
    33
    @skiy ssl 没试过,但自定义域名是可以的
    soseek
    soseek
    Jul 29, 2025 via iPhone
    34
    @skiy 交钱就可以啦
    rmrf
    rmrf
    Jul 29, 2025
    35
    这个跟 vercel 比如何啊?
    terryso
    terryso
    OP
    Jul 29, 2025
    36
    @rmrf 这个简单
    onebitbank
    onebitbank
    Sep 22, 2025
    37
    @terryso 为什么我用 surge 部署后不配置自定义域名,过几个小时,网站就无法访问了
    onebitbank
    onebitbank
    Sep 22, 2025
    38
    不是被墙,是 surge 提示网站 unavaiable
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   2405 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 71ms · UTC 15:43 · PVG 23:43 · LAX 07:43 · JFK 10:43
    ♥ Do have faith in what you're doing.