Update nginx.conf
Browse files- nginx.conf +16 -22
nginx.conf
CHANGED
|
@@ -62,50 +62,44 @@ http {
|
|
| 62 |
|
| 63 |
#include /etc/nginx/conf.d/*.conf;
|
| 64 |
#include /etc/nginx/sites-enabled/*;
|
| 65 |
-
|
| 66 |
listen 7860;
|
| 67 |
-
|
| 68 |
-
access_log /tmp/access.log;
|
| 69 |
server_name _;
|
| 70 |
|
| 71 |
-
root
|
| 72 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 73 |
location /stable-#COMMIT# {
|
| 74 |
proxy_pass http://127.0.0.1:5050;
|
| 75 |
proxy_http_version 1.1;
|
| 76 |
proxy_set_header Upgrade $http_upgrade;
|
| 77 |
proxy_set_header Connection "Upgrade";
|
| 78 |
proxy_set_header Host $host;
|
| 79 |
-
proxy_read_timeout 86400;
|
| 80 |
-
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
| 81 |
}
|
| 82 |
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
proxy_pass http://127.0.0.1:5050/;
|
| 87 |
proxy_http_version 1.1;
|
| 88 |
proxy_set_header Upgrade $http_upgrade;
|
| 89 |
proxy_set_header Connection "Upgrade";
|
| 90 |
proxy_set_header Host $host;
|
| 91 |
proxy_read_timeout 86400;
|
| 92 |
-
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
| 93 |
-
}
|
| 94 |
-
|
| 95 |
-
location @vscode {
|
| 96 |
-
return 302 https://$host/vscode/?folder=/home/user/app;
|
| 97 |
}
|
| 98 |
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
|
|
|
| 102 |
proxy_http_version 1.1;
|
| 103 |
proxy_set_header Upgrade $http_upgrade;
|
| 104 |
proxy_set_header Connection "Upgrade";
|
| 105 |
proxy_set_header Host $host;
|
| 106 |
-
|
| 107 |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
| 108 |
-
#try_files $uri $uri/ =404;
|
| 109 |
}
|
| 110 |
-
}
|
| 111 |
-
}
|
|
|
|
| 62 |
|
| 63 |
#include /etc/nginx/conf.d/*.conf;
|
| 64 |
#include /etc/nginx/sites-enabled/*;
|
| 65 |
+
server {
|
| 66 |
listen 7860;
|
|
|
|
|
|
|
| 67 |
server_name _;
|
| 68 |
|
| 69 |
+
# 1. SECURITY: Points to the root-owned password file
|
| 70 |
+
auth_basic "Root Workspace";
|
| 71 |
+
auth_basic_user_file /root/app/ngpasswd;
|
| 72 |
+
|
| 73 |
+
# 2. VS CODE INTERNAL ASSETS:
|
| 74 |
+
# Crucial! Without this, you get a blank white screen.
|
| 75 |
location /stable-#COMMIT# {
|
| 76 |
proxy_pass http://127.0.0.1:5050;
|
| 77 |
proxy_http_version 1.1;
|
| 78 |
proxy_set_header Upgrade $http_upgrade;
|
| 79 |
proxy_set_header Connection "Upgrade";
|
| 80 |
proxy_set_header Host $host;
|
|
|
|
|
|
|
| 81 |
}
|
| 82 |
|
| 83 |
+
# 3. MAIN INTERFACE:
|
| 84 |
+
# Maps the Space URL directly to VS Code on 5050.
|
| 85 |
+
location / {
|
| 86 |
proxy_pass http://127.0.0.1:5050/;
|
| 87 |
proxy_http_version 1.1;
|
| 88 |
proxy_set_header Upgrade $http_upgrade;
|
| 89 |
proxy_set_header Connection "Upgrade";
|
| 90 |
proxy_set_header Host $host;
|
| 91 |
proxy_read_timeout 86400;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 92 |
}
|
| 93 |
|
| 94 |
+
# 4. DYNAMIC PORT FORWARDING:
|
| 95 |
+
# Access any other app (e.g., Port 3000) via /proxy/3000/
|
| 96 |
+
location ~ ^/proxy/([0-9]+)/(.*)$ {
|
| 97 |
+
proxy_pass http://127.0.0.1:$1/$2$is_args$args;
|
| 98 |
proxy_http_version 1.1;
|
| 99 |
proxy_set_header Upgrade $http_upgrade;
|
| 100 |
proxy_set_header Connection "Upgrade";
|
| 101 |
proxy_set_header Host $host;
|
| 102 |
+
proxy_set_header X-Real-IP $remote_addr;
|
| 103 |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
|
|
| 104 |
}
|
| 105 |
+
}
|
|
|