10
10
- [ SSH forwarding] ( #ssh-forwarding )
11
11
- [ Let's Encrypt] ( #lets-encrypt )
12
12
- [ Self Signed Certificate] ( #self-signed-certificate )
13
+ - [ NGINX] ( #nginx )
13
14
- [ Change the password?] ( #change-the-password )
14
15
- [ How do I securely access development web services?] ( #how-do-i-securely-access-development-web-services )
15
16
@@ -193,6 +194,8 @@ mydomain.com
193
194
reverse_proxy 127.0.0.1:8080
194
195
```
195
196
197
+ Remember to replace ` mydomain.com ` with your domain name!
198
+
196
199
5 . Reload caddy with:
197
200
198
201
``` bash
@@ -204,6 +207,48 @@ Visit `https://<your-domain-name>` to access `code-server`. Congratulations!
204
207
In a future release we plan to integrate Let's Encrypt directly with ` code-server ` to avoid
205
208
the dependency on caddy.
206
209
210
+ #### NGINX
211
+
212
+ If you prefer to use NGINX instead of Caddy then please follow steps 1-2 above and then:
213
+
214
+ 3 . Install ` nginx ` :
215
+
216
+ ``` bash
217
+ sudo apt update
218
+ sudo apt install -y nginx certbot python-certbot-nginx
219
+ ```
220
+
221
+ 4 . Put the following config into ` /etc/nginx/sites-available/code-server ` with sudo:
222
+
223
+ ``` nginx
224
+ server {
225
+ listen 80;
226
+ listen [::]:80;
227
+ server_name mydomain.com;
228
+
229
+ location / {
230
+ proxy_pass http://localhost:8080/;
231
+ proxy_set_header Host $host;
232
+ proxy_set_header Upgrade $http_upgrade;
233
+ proxy_set_header Connection upgrade;
234
+ proxy_set_header Accept-Encoding gzip;
235
+ }
236
+ }
237
+ ```
238
+
239
+ Remember to replace ` mydomain.com ` with your domain name!
240
+
241
+ 5 . Enable the config:
242
+
243
+ ``` bash
244
+ sudo ln -s ../sites-available/code-server /etc/nginx/sites-enabled/code-server
245
+ sudo certbot --non-interactive --redirect --agree-tos --nginx -d mydomain.com -m
[email protected]
246
+ ```
247
+
248
+ Make sure to substitute
` [email protected] ` with your actual email.
249
+
250
+ Visit ` https://<your-domain-name> ` to access ` code-server ` . Congratulations!
251
+
207
252
### Self Signed Certificate
208
253
209
254
** note:** Self signed certificates do not work with iPad and will cause a blank page. You'll
@@ -244,29 +289,6 @@ To avoid the warnings, you can use [mkcert](https://mkcert.dev) to create a self
244
289
trusted by your OS and then pass it into ` code-server ` via the ` cert ` and ` cert-key ` config
245
290
fields.
246
291
247
- ### Nginx reverse proxy
248
-
249
- If you prefer to use Nginx instead of Caddy here is a sample config (put e.g. in
250
- ` /etc/nginx/sites-enabled/code-server ` ):
251
-
252
- ``` nginx
253
- server {
254
- listen 80 [::]:80;
255
- server_name your-domain-name-here.com;
256
-
257
- location / {
258
- proxy_pass http://127.0.0.1:8080/;
259
- proxy_set_header Host $host;
260
- proxy_set_header Upgrade $http_upgrade;
261
- proxy_set_header Connection upgrade;
262
- proxy_set_header Accept-Encoding gzip;
263
- }
264
- }
265
- ```
266
-
267
- It's highly recommended to set up a LetsEncrypt certificate and HTTP->HTTPS redirect as well.
268
- In order to do this run ` certbot --nginx -d your-domain-name-here.com ` .
269
-
270
292
### Change the password?
271
293
272
294
Edit the ` password ` field in the ` code-server ` config file at ` ~/.config/code-server/config.yaml `
0 commit comments