code server安装与配置

刚好这段时间换了服务器,就想着远程开发,本来想用visual code 的remote ssh 但是还要在本地安装visual code,所以就选择了github上一个比较火的项目code-server,记录下配置过程

1.下载与安装(基于debian)

curl -fOL https://github.com/cdr/code-server/releases/download/v3.9.3/code-server_3.9.3_amd64.deb
sudo dpkg -i code-server_3.9.3_amd64.deb
sudo systemctl enable --now code-server@$USER   #支持开机自启
sudo systemctl disable code-server@$USER  
#取消开机自启
sudo systemctl restart code-server@$USER        #重启服务
#$USER可替换为root用户 
#Now visit http://127.0.0.1:8080. Your password is in ~/.config/code-server/config.yaml

2.nginx反代

server
{
    listen 443 ssl;
    server_name code.honus.top;
    ssl_certificate    /www/server/panel/vhost/cert/code.honus.top/fullchain.pem;
    ssl_certificate_key    /www/server/panel/vhost/cert/code.honus.top/privkey.pem;
    
    #一键申请SSL证书验证目录相关设置
    location ~ \.well-known{
        allow all;
    }
    location / {
        proxy_pass http://localhost:8080/;
        proxy_set_header Host $host;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection upgrade;
        proxy_set_header Accept-Encoding gzip;
    }
    access_log  /www/wwwlogs/code.honus.top.log;
    error_log  /www/wwwlogs/code.honus.top.error.log;
}

赞 (3)

评论区

发表评论

暂无评论,要不来一发?

回到顶部