1. Install some dependencies and necessary tools
sudo apt install curl wget vim clang gcc python -y
2. Install code-server
curl -fsSL https://code-server.dev/install.sh | sh
code-server
Edit the configuration file to modify the listening port and password
vim ~/.config/code-server/config.yaml
bind-addr: 0.0.0.0:8080 ##IP and port for the code-server to bind to. Note that code-server only allows local connections by default, so it is recommended to change 8080 to another port, e.g., 2333, and use Nginx as a reverse proxy. auth: password password: your_authentication_password ##Enter the access password you want to set for code-server here cert: false ##Keep false; this is a self-signed certificate, and almost no browser recognizes it.Run in the background:
nohup code-server >/dev/null 2>&1 &
Nginx reverse proxy:
location / {
## Local code-server port
proxy_pass http://localhost:8080/;
## Necessary header settings
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection upgrade;
proxy_set_header Accept-Encoding gzip;
}
暂无评论。