You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何在子路径部署VS Code Web服务?

将VS Code Web部署到子路径的方法

VS Code的code命令提供serve-web选项,可启动Web服务器供浏览器访问,默认部署在根路径(如示例中的http://127.0.0.1:8000),示例启动命令如下:

% code serve-web --without-connection-token

* Visual Studio Code Server
*
* By using the software, you agree to
* the Visual Studio Code Server License Terms and
* the Microsoft Privacy Statement.
*
Web UI available at http://127.0.0.1:8000

问题

如何将该VS Code实例部署在子路径(如http://127.0.0.1/ide)而非根路径?

解决方法

使用--path参数指定子路径即可,配合现有参数执行命令:

code serve-web --without-connection-token --path /ide

执行后,VS Code Web的访问地址会变为http://127.0.0.1:8000/ide。

如果需要将端口改为80(访问时无需输入端口号),可以加上--port参数:

code serve-web --without-connection-token --path /ide --port 80

此时访问地址就是http://127.0.0.1/ide。

注意:如果使用反向代理配合部署,需要确保代理服务器也配置对应的子路径转发规则;仅使用VS Code自带的serve-web时,--path参数可直接生效。

内容的提问来源于stack exchange,提问作者Mohamed

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.10 20:24:53