赞
踩
官网地址:https://coder.com/
前往code-server官网下载deb包:code-server_4.2.0_amd64.deb
安装deb包:
sudo apt apt install ./*.deb
code-server
修改配置文件:
vim ~/.config/code-server/config.yaml
bind-addr: 127.0.0.1:3333
auth: password
password: xxx
sudo vim /etc/nginx/nginx.conf
server { # 要监听的公网端口号 listen 1024 ssl http2; # 改为你的网址 server_name http://cdq.net.cn; # 证书的公私钥 ssl_certificate /data/config/cdq.net.cn_nginx/cdq.net.cn_bundle.crt; ssl_certificate_key /data/config/cdq.net.cn_nginx/cdq.net.cn.key; location / { # code-server的 PORT,要转发的内部端口号 proxy_pass http://127.0.0.1:3333; proxy_set_header Host $host; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection upgrade; proxy_set_header Accept-Encoding gzip; } }
sudo systemctl restart nginx
开放 1024 端口。
sudo vim /usr/lib/systemd/system/codeserver.service
[Unit] Description=codeserver Documentation=https://coder.com/ After=network.target After=mysqld.service Wants=network.target [Service] User=redis Group=redis WorkingDirectory=/home/redis ExecStart=/usr/bin/code-server >/dev/null 2>&1 Restart=on-abnormal RestartSec=5s KillMode=mixed StandardOutput=null StandardError=syslog [Install] WantedBy=multi-user.target
更新配置
sudo systemctl daemon-reload
启动服务
sudo systemctl start codeserver
设置开机启动
sudo systemctl enable codeserver
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。