1010 - [ SSH forwarding] ( #ssh-forwarding )
1111 - [ Let's Encrypt] ( #lets-encrypt )
1212 - [ Self Signed Certificate] ( #self-signed-certificate )
13+ - [ NGINX] ( #nginx )
1314 - [ Change the password?] ( #change-the-password )
1415 - [ How do I securely access development web services?] ( #how-do-i-securely-access-development-web-services )
1516
@@ -193,6 +194,8 @@ mydomain.com
193194reverse_proxy 127.0.0.1:8080
194195```
195196
197+ Remember to replace ` mydomain.com ` with your domain name!
198+
1961995 . Reload caddy with:
197200
198201``` bash
@@ -204,6 +207,48 @@ Visit `https://<your-domain-name>` to access `code-server`. Congratulations!
204207In a future release we plan to integrate Let's Encrypt directly with ` code-server ` to avoid
205208the dependency on caddy.
206209
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 me@example.com
246+ ```
247+
248+ Make sure to substiute ` me@example.com ` with your actual email.
249+
250+ Visit ` https://<your-domain-name> ` to access ` code-server ` . Congratulations!
251+
207252### Self Signed Certificate
208253
209254** 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
244289trusted by your OS and then pass it into ` code-server ` via the ` cert ` and ` cert-key ` config
245290fields.
246291
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-
270292### Change the password?
271293
272294Edit the ` password ` field in the ` code-server ` config file at ` ~/.config/code-server/config.yaml `
0 commit comments