当前位置: 首页 > ai >正文

code-server安装使用,并配置frp反射域名访问

为什么使用

        code-server是VSCode网页版开发软件,可以在浏览器访问编程,可以使用vscode中的插件。如果有自己的服务器,使用frp透传后,域名访问在线编程,使用方便,打开的服务端口不需要单独配置,可以直接在原域下访问,使用方便。

安装配置

arm环境下载地址:

# 替换最新版本号(查看 https://github.com/coder/code-server/releases)
VERSION="4.22.0"  # 示例版本,请检查最新版
wget https://github.com/coder/code-server/releases/download/v$VERSION/code-server_${VERSION}_arm64.deb
或
wget https://github.com/coder/code-server/releases/download/v$VERSION/code-server_4.22.0_arm64.deb
现在新版地址
wget https://github.com/coder/code-server/releases/download/v4.100.2/code-server_4.100.2_arm64.deb

amd系统下载地址:

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

下载后安装

sudo dpkg -i code-server_4.22.0_amd64.deb
sudo apt install -f  # 修复依赖

安装后使用

-- 启动
code-server
-- 密码参考文件内配置,默认只在本机能访问,也可以在配置中更改为0.0.0.0外部访问
nano /root/.config/code-server/config.yaml
-- 我的配置
bind-addr: 0.0.0.0:8080
auth: password
password: xxxx密码
cert: false

插件管理

官方参考手册:Extension Marketplace

离线安装插件,下载后指定本地文件安装

code-server --install-extension /path/to/blockman-highlight.vsix

安装微软官网对vscode的插件

去官网搜索下载,用上面命令安装,或如下插件安装,https://marketplace.visualstudio.com

-- C#插件
扩展中搜索安装vscode-plugin-installer安装后ctrl + shift + p输入命令回车:VS Code Plugin Installer输入对应插件地址,如:https://marketplace.visualstudio.com/items?itemName=ms-dotnettools.csdevkit根据提示Enter确认安装,Esc取消

 相关插件下载地址

https://github.com/dotnet/vscode-csharp/releases/tag/v1.24.4

NGINX域名解析和FRP透传配置参考我之前在香橙派上网站配置介绍:OrangePi AIpro从上手到网站部署使用_orange pi aipro 远程登录-CSDN博客

 由于code-server除了界面透传,还需要进行websocket通讯,所以,还需要在NGINX中添加websocket配置,配置如下

# 在 http{} 块内定义 mapmap $http_upgrade $connection_upgrade {default upgrade;''      close;}server {listen        80;server_name   xxx.com;location / {index index.html vnc.html;proxy_pass http://xxxx:6060;}location ~ ^/(websockify|socket) {# 启用调试日志access_log /var/log/nginx/websocket.log;error_log /var/log/nginx/websocket_error.log debug;proxy_pass http://xxx:6060;proxy_http_version 1.1;proxy_set_header Upgrade $http_upgrade;             # 自动填 websocket 或空proxy_set_header Connection $connection_upgrade;    # 自动填 upgrade 或 close# 如果后端需要特定 Host 头proxy_set_header Host $host;# 标准代理头(必须!)proxy_set_header Host aipro.missingyou.wang;                  # 传递客户端请求的域名proxy_set_header X-Real-IP xxxxxx;         #$remote_addr;      # 客户端真实 IP#proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;  # 经过的代理链 IPproxy_set_header X-Forwarded-Proto $scheme;   # 协议(http/ws 或 https/wss)# 关键优化:禁用缓冲和超时设置proxy_buffering off;proxy_read_timeout 86400s;  # 长连接超时(WebSocket 需要)}}

http://www.xdnf.cn/news/12622.html

相关文章:

  • 基于Java Swing的固定资产管理系统设计与实现:附完整源码与论文
  • 7 天六级英语翻译与写作冲刺计划
  • 【Dv3Admin】系统视图字典管理API文件解析
  • MySQL:Cannot remove all partitions, use DROP TABLE instead
  • C++ 变量和基本类型
  • 意识上传伦理前夜:我们是否在创造数字奴隶?
  • KVC与KVO
  • Scade 语言概念 - 方程(equation)
  • DenseNet算法 实现乳腺癌识别
  • 游戏(game)
  • Go 语言 := 运算符详解(短变量声明)
  • Sum of Prod of Mod of Linear_abc402G
  • python的numpy的MKL加速
  • C# 类和继承(扩展方法)
  • 高精度算法--四则运算模板(附例题)
  • Nginx Stream 层连接数限流实战ngx_stream_limit_conn_module
  • SpringBoot十二、SpringBoot系列web篇之过滤器Filte详解
  • 2.3 VS2019 简单使用
  • LLM 笔记:Speculative Decoding 投机采样
  • HTML 面试题错题总结与解析
  • vue3 icon 图标 使用方法
  • VScode打开后一直显示正在重新激活终端 问题的解决方法
  • Modbus RTU与Modbus TCP详解指南
  • 安卓基础(编译.Class)
  • MCP详解及协议的使用(python版本和Node版本)
  • 【HarmonyOS 5.0】DevEco Testing:鸿蒙应用质量保障的终极武器
  • cv2.stereoRectify中R1, R2, P1, P2, Q中每一个分量的物理意义
  • grep、wc 与管道符快速上手指南
  • Linux八股【3】-----系统框架概述
  • SpringBoot项目接口集中测试方法及实现