justest commited on
Commit
3f835c3
·
1 Parent(s): a341539

Update nginx.conf

Browse files
Files changed (1) hide show
  1. nginx.conf +104 -21
nginx.conf CHANGED
@@ -1,28 +1,111 @@
1
- #!/bin/bash
 
 
 
2
 
3
- NGX_NAME="${NGX_NAME:-admin}"
4
- NGX_PASS="${NGX_PASS:-admin}"
5
- CRYPTPASS=`openssl passwd -apr1 ${NGX_PASS}`
6
- PORT="${PORT:-8080}"
7
 
8
- echo "USERNAME:" $NGX_NAME
9
- echo "PASSWORD:" $NGX_PASS
 
 
10
 
11
- echo "${NGX_NAME}:${CRYPTPASS}" > ngpasswd
 
 
 
 
 
 
 
 
12
 
13
- commit=$(cat /app/openvscode-server/product.json | awk '/commit/{print $4;exit}' FS='[""]')
14
- sed -i "s/#commit#/$commit/" nginx.conf
15
- sed -i "s/#PORT#/$PORT/" nginx.conf
16
- nginx -c $PWD/nginx.conf
17
 
18
- set +e
19
- if [[ ! -z "$REPO" ]]; then
20
- echo start to clone initial repo $repo
21
- git clone --progress $REPO
22
- fi
23
- set -e
24
- git config --global http.postBuffer 524288000
25
 
26
- echo "Starting VSCode Server..."
 
 
 
 
 
27
 
28
- exec /app/openvscode-server/bin/openvscode-server --host 0.0.0.0 --port 5050 --without-connection-token \"${@}\" --
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ error_log /tmp/error.log warn;
2
+ worker_processes auto;
3
+ pid /tmp/nginx.pid;
4
+ include /etc/nginx/modules-enabled/*.conf;
5
 
6
+ events {
7
+ worker_connections 768;
8
+ multi_accept on;
9
+ }
10
 
11
+ http {
12
+ ##
13
+ # Basic Settings
14
+ ##
15
 
16
+ sendfile on;
17
+ tcp_nopush on;
18
+ tcp_nodelay on;
19
+ keepalive_timeout 65;
20
+ types_hash_max_size 2048;
21
+ proxy_buffering off;
22
+ client_max_body_size 800m;
23
+ large_client_header_buffers 4 32k;
24
+ # server_tokens off;
25
 
26
+ # server_names_hash_bucket_size 64;
27
+ # server_name_in_redirect off;
 
 
28
 
29
+ include /etc/nginx/mime.types;
 
 
 
 
 
 
30
 
31
+ default_type application/octet-stream;
32
+ proxy_temp_path /tmp/proxy_temp;
33
+ client_body_temp_path /tmp/client_temp;
34
+ fastcgi_temp_path /tmp/fastcgi_temp;
35
+ uwsgi_temp_path /tmp/uwsgi_temp;
36
+ scgi_temp_path /tmp/scgi_temp;
37
 
38
+ ##
39
+ # SSL Settings
40
+ ##
41
+
42
+ ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3; # Dropping SSLv3, ref: POODLE
43
+ ssl_prefer_server_ciphers on;
44
+
45
+
46
+ ##
47
+ # Gzip Settings
48
+ ##
49
+
50
+ gzip on;
51
+
52
+ # gzip_vary on;
53
+ # gzip_proxied any;
54
+ # gzip_comp_level 6;
55
+ # gzip_buffers 16 8k;
56
+ # gzip_http_version 1.1;
57
+ # gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
58
+
59
+ ##
60
+ # Virtual Host Configs
61
+ ##
62
+
63
+ #include /etc/nginx/conf.d/*.conf;
64
+ #include /etc/nginx/sites-enabled/*;
65
+ server {
66
+ listen 7860;
67
+
68
+ access_log /tmp/access.log;
69
+ server_name _;
70
+
71
+ root /var/www/;
72
+ index index.html;
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
+ location /vscode/ {
84
+ auth_basic "Restricted Content";
85
+ auth_basic_user_file /home/user/app/ngpasswd;
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
+ error_page 502 = @vscode;
100
+ location / {
101
+ proxy_pass http://127.0.0.1:#PORT#;
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
+ proxy_read_timeout 86400;
107
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
108
+ #try_files $uri $uri/ =404;
109
+ }
110
+ }
111
+ }