code-server安装及nginx代理

ubuntu 22.04系统中下载安装code-server

ubuntu安装code-server

1
wget https://github.com/coder/code-server/releases/download/v4.21.1/code-server_4.21.1_amd64.deb

或直接在 github 下载解压至 /cs/code-server 目录下

安装

1
dpkg -i code-server_4.21.1_amd64.deb

运行一次生成配置文件(可去修改配置文件密码 vim ~/.config/code-server/config.yaml,我选择是命令加参数的方式)

1
code-server

开启服务

1
sudo systemctl start code-server@root

开机自启

1
sudo systemctl enable code-server@root

命令加参数,编写启动脚本 start_vscode.sh

1
code-server --port 8089 --host 0.0.0.0 --auth password

使用pm2启动
pm2 start start_vscode.sh

centos安装code-server

>>链接<<

nginx代理

报错

  • The workbench failed to connect to the server (Error: WebSocket close with status code 1006)
    需要配置
    1
    2
    3
    4
    5
    6
    7
    location / {
    proxy_pass http://codeserver.xxx.xxx:8089/;
    proxy_set_header Host $host;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection upgrade;
    proxy_set_header Accept-Encoding gzip;
    }
    详情见参考资料

更新code-server

先停止服务

1
pm2 stop start_vscode
1
wget https://github.com/coder/code-server/releases/download/v4.93.1/code-server_4.93.1_amd64.deb

或直接在 github 下载解压至 /cs/code-server 目录下

安装

1
dpkg -i code-server_4.93.1_amd64.deb

启动服务

1
pm2 start start_vscode

检查版本

1
code-server -v

返回值 4.93.1 * with Code 1.93.1

参考资料

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

https://github.com/coder/code-server/blob/main/docs/guide.md#using-lets-encrypt-with-nginx


code-server安装及nginx代理
http://example.com/20240306-code-server安装及nginx代理/
作者
csorz
发布于
2024年10月8日
许可协议