typora/note/工具集/code-server+nginx.md

30 lines
739 B
Markdown
Raw Normal View History

2024-12-11 21:48:55 -05:00
### 部署code-server
``` bash
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 反向代理
```go
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 "";
}
```