From a9037d7d1651c3e091a9f5d5c3d677466d4cae25 Mon Sep 17 00:00:00 2001 From: Sim Date: Tue, 5 Oct 2021 21:38:59 +0800 Subject: [PATCH 1/3] nginx config minor bug fixed without ^~, resources in folders like /static cannot be accessed. --- docs/guide.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/guide.md b/docs/guide.md index 80d01ddca74b..6aeea7ffc8df 100644 --- a/docs/guide.md +++ b/docs/guide.md @@ -198,7 +198,7 @@ At this point, you should be able to access code-server via listen [::]:80; server_name mydomain.com; - location / { + location ^~ / { proxy_pass http://localhost:8080/; proxy_set_header Host $host; proxy_set_header Upgrade $http_upgrade; @@ -575,7 +575,7 @@ At this point, you should be able to access code-server via listen [::]:80; server_name mydomain.com; - location / { + location ^~ / { proxy_pass http://localhost:8080/; proxy_set_header Host $host; proxy_set_header Upgrade $http_upgrade; From d0bd668b86d8a152f9c14efb2f1a7221d3441184 Mon Sep 17 00:00:00 2001 From: Sim Date: Thu, 7 Oct 2021 22:53:23 +0800 Subject: [PATCH 2/3] /static path needs proxy_pass too. --- docs/guide.md | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/docs/guide.md b/docs/guide.md index 6aeea7ffc8df..30890f7519de 100644 --- a/docs/guide.md +++ b/docs/guide.md @@ -198,7 +198,15 @@ At this point, you should be able to access code-server via listen [::]:80; server_name mydomain.com; - location ^~ / { + location / { + proxy_pass http://localhost:8080/; + proxy_set_header Host $host; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection upgrade; + proxy_set_header Accept-Encoding gzip; + } + + location /static { proxy_pass http://localhost:8080/; proxy_set_header Host $host; proxy_set_header Upgrade $http_upgrade; @@ -575,7 +583,15 @@ At this point, you should be able to access code-server via listen [::]:80; server_name mydomain.com; - location ^~ / { + location / { + proxy_pass http://localhost:8080/; + proxy_set_header Host $host; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection upgrade; + proxy_set_header Accept-Encoding gzip; + } + + location /static { proxy_pass http://localhost:8080/; proxy_set_header Host $host; proxy_set_header Upgrade $http_upgrade; From cb5286a55acd48af743b0006c6a53173cd74cae5 Mon Sep 17 00:00:00 2001 From: Sim Date: Sun, 10 Oct 2021 20:23:37 +0800 Subject: [PATCH 3/3] basically duplicating block is not working --- docs/guide.md | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/docs/guide.md b/docs/guide.md index 30890f7519de..6aeea7ffc8df 100644 --- a/docs/guide.md +++ b/docs/guide.md @@ -198,15 +198,7 @@ At this point, you should be able to access code-server via listen [::]:80; server_name mydomain.com; - location / { - proxy_pass http://localhost:8080/; - proxy_set_header Host $host; - proxy_set_header Upgrade $http_upgrade; - proxy_set_header Connection upgrade; - proxy_set_header Accept-Encoding gzip; - } - - location /static { + location ^~ / { proxy_pass http://localhost:8080/; proxy_set_header Host $host; proxy_set_header Upgrade $http_upgrade; @@ -583,15 +575,7 @@ At this point, you should be able to access code-server via listen [::]:80; server_name mydomain.com; - location / { - proxy_pass http://localhost:8080/; - proxy_set_header Host $host; - proxy_set_header Upgrade $http_upgrade; - proxy_set_header Connection upgrade; - proxy_set_header Accept-Encoding gzip; - } - - location /static { + location ^~ / { proxy_pass http://localhost:8080/; proxy_set_header Host $host; proxy_set_header Upgrade $http_upgrade;