abenkbp commited on
Commit
8741eae
·
1 Parent(s): fc3abf4
Files changed (3) hide show
  1. data/config_nginx.sh +4 -29
  2. data/nginx.conf +0 -39
  3. data/nginx.conf.tempate +56 -0
data/config_nginx.sh CHANGED
@@ -1,30 +1,5 @@
1
  #!/bin/bash
2
-
3
- bash -c 'cat > /etc/nginx/nginx.conf <<EOF
4
- worker_processes auto;
5
- pid /run/nginx.pid;
6
- error_log /var/log/nginx/error.log;
7
- include /etc/nginx/modules-enabled/*.conf;
8
-
9
- events {
10
- worker_connections 768;
11
- }
12
-
13
- http {
14
- sendfile on;
15
- tcp_nopush on;
16
- types_hash_max_size 2048;
17
-
18
- include /etc/nginx/mime.types;
19
- default_type application/octet-stream;
20
-
21
- ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3;
22
- ssl_prefer_server_ciphers on;
23
-
24
- access_log /var/log/nginx/access.log;
25
- gzip on;
26
- include /home/user/app/data/*.conf;
27
- }
28
- EOF'
29
-
30
- echo "nginx.conf has been written to /etc/nginx/nginx.conf"
 
1
  #!/bin/bash
2
+ envsubst '${GRADIO_SERVER_PORT},${N8N_PORT},${BACKEND_PORT}' < /home/user/app/data/nginx.conf.template > /etc/nginx/nginx.conf
3
+ echo "nginx.conf has been written to /etc/nginx/nginx.conf"
4
+ echo "starting up NginX"
5
+ /usr/sbin/nginx -g 'daemon off;'
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
data/nginx.conf DELETED
@@ -1,39 +0,0 @@
1
- server {
2
- listen 7860;
3
- listen [::]:7860;
4
-
5
- server_name agent-one.ai.ucode.id;
6
-
7
- location / {
8
- proxy_pass http://localhost:5678;
9
- proxy_http_version 1.1;
10
- proxy_set_header Upgrade $http_upgrade;
11
- proxy_set_header Connection 'upgrade';
12
- proxy_set_header Host $host;
13
- proxy_set_header X-Real-IP $remote_addr;
14
- proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
15
- proxy_cache_bypass $http_upgrade;
16
- proxy_read_timeout 86400;
17
- proxy_redirect off;
18
- }
19
- }
20
-
21
- server {
22
- listen 7860;
23
- listen [::]:7860;
24
-
25
- server_name ucode-agent.hf.space;
26
-
27
- location / {
28
- proxy_pass http://localhost:7000;
29
- proxy_http_version 1.1;
30
- proxy_set_header Upgrade $http_upgrade;
31
- proxy_set_header Connection 'upgrade';
32
- proxy_set_header Host $host;
33
- proxy_set_header X-Real-IP $remote_addr;
34
- proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
35
- proxy_cache_bypass $http_upgrade;
36
- proxy_read_timeout 86400;
37
- proxy_redirect off;
38
- }
39
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
data/nginx.conf.tempate ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ worker_processes auto;
2
+ pid /run/nginx.pid;
3
+ error_log /var/log/nginx/error.log;
4
+ include /etc/nginx/modules-enabled/*.conf;
5
+
6
+ events {
7
+ worker_connections 768;
8
+ }
9
+
10
+ http {
11
+ sendfile on;
12
+ tcp_nopush on;
13
+ types_hash_max_size 2048;
14
+
15
+ include /etc/nginx/mime.types;
16
+ default_type application/octet-stream;
17
+
18
+ ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3;
19
+ ssl_prefer_server_ciphers on;
20
+
21
+ access_log /var/log/nginx/access.log;
22
+ gzip on;
23
+ server {
24
+ listen 7860;
25
+ listen [::]:7860;
26
+
27
+ server_name _;
28
+
29
+ location / {
30
+ proxy_pass http://localhost:${N8N_PORT};
31
+ proxy_http_version 1.1;
32
+ proxy_set_header Upgrade $http_upgrade;
33
+ proxy_set_header Connection 'upgrade';
34
+ proxy_set_header Host $host;
35
+ proxy_set_header X-Real-IP $remote_addr;
36
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
37
+ proxy_set_header Authorization 'Bearer ${AGENT_ONE_SECRET}';
38
+ proxy_cache_bypass $http_upgrade;
39
+ proxy_read_timeout 86400;
40
+ proxy_redirect off;
41
+ }
42
+
43
+ location /gradio {
44
+ proxy_pass http://localhost:${GRADIO_SERVER_PORT};
45
+ proxy_http_version 1.1;
46
+ proxy_set_header Upgrade $http_upgrade;
47
+ proxy_set_header Connection 'upgrade';
48
+ proxy_set_header Host $host;
49
+ proxy_set_header X-Real-IP $remote_addr;
50
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
51
+ proxy_cache_bypass $http_upgrade;
52
+ proxy_read_timeout 86400;
53
+ proxy_redirect off;
54
+ }
55
+ }
56
+ }