justest commited on
Commit
02fb3a6
·
1 Parent(s): c5245d6

Update nginx.conf

Browse files
Files changed (1) hide show
  1. nginx.conf +21 -105
nginx.conf CHANGED
@@ -1,112 +1,28 @@
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
- ##
14
- # Basic Settings
15
- ##
16
 
17
- sendfile on;
18
- tcp_nopush on;
19
- tcp_nodelay on;
20
- keepalive_timeout 65;
21
- types_hash_max_size 2048;
22
- proxy_buffering off;
23
- client_max_body_size 800m;
24
- large_client_header_buffers 4 32k;
25
- # server_tokens off;
26
 
27
- # server_names_hash_bucket_size 64;
28
- # server_name_in_redirect off;
 
 
 
 
 
29
 
30
- include /etc/nginx/mime.types;
31
 
32
- default_type application/octet-stream;
33
- proxy_temp_path /tmp/proxy_temp;
34
- client_body_temp_path /tmp/client_temp;
35
- fastcgi_temp_path /tmp/fastcgi_temp;
36
- uwsgi_temp_path /tmp/uwsgi_temp;
37
- scgi_temp_path /tmp/scgi_temp;
38
-
39
- ##
40
- # SSL Settings
41
- ##
42
-
43
- ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3; # Dropping SSLv3, ref: POODLE
44
- ssl_prefer_server_ciphers on;
45
-
46
-
47
- ##
48
- # Gzip Settings
49
- ##
50
-
51
- gzip on;
52
-
53
- # gzip_vary on;
54
- # gzip_proxied any;
55
- # gzip_comp_level 6;
56
- # gzip_buffers 16 8k;
57
- # gzip_http_version 1.1;
58
- # gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
59
-
60
- ##
61
- # Virtual Host Configs
62
- ##
63
-
64
- #include /etc/nginx/conf.d/*.conf;
65
- #include /etc/nginx/sites-enabled/*;
66
- server {
67
- listen 7860;
68
-
69
- access_log /tmp/access.log;
70
- server_name _;
71
-
72
- root /var/www/;
73
- index index.html;
74
- location /stable-#commit# {
75
- proxy_pass http://127.0.0.1:5050;
76
- proxy_http_version 1.1;
77
- proxy_set_header Upgrade $http_upgrade;
78
- proxy_set_header Connection "Upgrade";
79
- proxy_set_header Host $host;
80
- proxy_read_timeout 86400;
81
- proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
82
- }
83
-
84
- location /vscode/ {
85
- auth_basic "Restricted Content";
86
- auth_basic_user_file /home/user/app/ngpasswd;
87
- proxy_pass http://127.0.0.1:5050/;
88
- proxy_http_version 1.1;
89
- proxy_set_header Upgrade $http_upgrade;
90
- proxy_set_header Connection "Upgrade";
91
- proxy_set_header Host $host;
92
- proxy_read_timeout 86400;
93
- proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
94
- }
95
-
96
- location @vscode {
97
- return 302 https://$host/vscode/?folder=/home/user/app;
98
- }
99
-
100
- error_page 502 = @vscode;
101
- location / {
102
- proxy_pass http://127.0.0.1:3000;
103
- proxy_http_version 1.1;
104
- proxy_set_header Upgrade $http_upgrade;
105
- proxy_set_header Connection "Upgrade";
106
- proxy_set_header Host $host;
107
- proxy_read_timeout 86400;
108
- proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
109
- #try_files $uri $uri/ =404;
110
- }
111
- }
112
- }
 
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 \"${@}\" --