在vps上安装vscodeserver

花费22元 买了腾讯的轻量2H2G40G

先安装了宝塔,现在

项目地址

https://github.com/coder/code-server/releases

随便找一个加速站

https://ghproxy.com
https://gh.api.99988866.xyz

获取到加速地址

 wget -c https://gh.api.99988866.xyz/https://github.com/coder/code-server/releases/download/v4.0.1/code-server-4.0.1-amd64.rpm

安装

yum localinstall code-server-4.0.1-amd64.rpm
#启动
sudo systemctl enable --now code-server@$USER

提示配置文件在 info Wrote default config file to ~/.config/code-server/config.yaml

nano  ~/.config/code-server/config.yaml

新版好像不可以通过http+密码的方式明文远程访问,因为域名还在备案迁移所以无法申请证书,所以暂时用ssh加密隧道来

#去掉密码访问
sed -i.bak 's/auth: password/auth: none/' ~/.config/code-server/config.yaml
#重启
sudo systemctl restart code-server@$USER
#在本机上搭建隧道代理
ssh -N -L 8080:127.0.0.1:8080 root@vps的ip
#在本机访问
http://127.0.0.1:8080

后来发现 可以不迁移备案直接访问,于是

在宝塔建站点,并创建数字证书,并使用cf的dns验证 把cf的密钥也给宝塔。

在站点的反向代理中,添加 配置代理,并在配置文件中添加。

proxy_set_header Host $host;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection upgrade;
proxy_set_header Accept-Encoding gzip;

然后

nano  ~/.config/code-server/config.yaml
#把验证的地方 改为 password,不然就公开了

systemctl start code-server@root

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值