typora/note/工具集/code-server+nginx.md
2024-12-12 10:48:55 +08:00

739 B

部署code-server

mkdir -p ~/.config
docker run -itd --name code-server \
  --network=internal \
  -v "/mnt/sdb3/Configs/code-server/.local/:/home/code/.local/" \
  -v "/mnt/sdb3/Configs/code-server/.config/:/root/.config/" \
  -v "/mnt/sdb3/Configs/code-server/project:/home/coder/project" \
  -u "$(id -u):$(id -g)" \
  -e "DOCKER_USER=$USER" \
  codercom/code-server:latest

nginx 反向代理

location /code/ {
  proxy_pass http://code-server:8080/;
  proxy_http_version 1.1;
  proxy_set_header Host $host:8443/code/;
  proxy_set_header Upgrade $http_upgrade;
  proxy_set_header Connection upgrade;
  proxy_set_header Accept-Encoding gzip;
  proxy_connect_timeout 600;
  proxy_set_header Origin "";
}