Skip to content

Commit 96af976

Browse files
authored
Add Nginx instructions to guide
Added Nginx instructions for people who prefer to use this instead of Caddy
1 parent 9ff0e45 commit 96af976

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

doc/guide.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,25 @@ To avoid the warnings, you can use [mkcert](https://mkcert.dev) to create a self
244244
trusted by your OS and then pass it into `code-server` via the `cert` and `cert-key` config
245245
fields.
246246

247+
### Nginx reverse proxy
248+
249+
If you prefer to use Nginx instead of Caddy, here is a sample config (put e.g. in `/etc/nginx/sites-enabled/code-server`):
250+
```nginx
251+
server {
252+
listen 80 [::]:80;
253+
server_name your-domain-name-here.com;
254+
255+
location / {
256+
proxy_pass http://127.0.0.1:8080;
257+
proxy_set_header Host $host;
258+
proxy_set_header Upgrade $http_upgrade;
259+
proxy_set_header Connection upgrade;
260+
proxy_set_header Accept-Encoding gzip;
261+
}
262+
}
263+
```
264+
It's highly recommended set up a LetsEncrypt certificate and HTTP->HTTPS redirect as well. In order to do this, run `certbot --nginx -d your-domain-name-here.com`.
265+
247266
### Change the password?
248267

249268
Edit the `password` field in the `code-server` config file at `~/.config/code-server/config.yaml`

0 commit comments

Comments
 (0)