michon commited on
Commit
9bdf567
·
verified ·
1 Parent(s): ff052c3

Update nginx.spaces.conf

Browse files
Files changed (1) hide show
  1. nginx.spaces.conf +74 -54
nginx.spaces.conf CHANGED
@@ -1,55 +1,75 @@
1
- events {
2
- worker_connections 1024;
3
- }
4
-
5
- http {
6
- include /etc/nginx/mime.types;
7
- default_type application/octet-stream;
8
-
9
- # Timeouts for WebSocket
10
- proxy_connect_timeout 7d;
11
- proxy_send_timeout 7d;
12
- proxy_read_timeout 7d;
13
- client_max_body_size 100M;
14
-
15
- # Hugging Face Spaces expects port 7860
16
- server {
17
- listen 7860;
18
- server_name _;
19
-
20
- # Frontend
21
- location / {
22
- proxy_pass http://localhost:3001;
23
- proxy_http_version 1.1;
24
- proxy_set_header Upgrade $http_upgrade;
25
- proxy_set_header Connection 'upgrade';
26
- proxy_set_header Host $host;
27
- proxy_cache_bypass $http_upgrade;
28
- proxy_set_header X-Real-IP $remote_addr;
29
- proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
30
- proxy_set_header X-Forwarded-Proto $scheme;
31
- }
32
-
33
- # Backend WebSocket
34
- location /ws {
35
- proxy_pass http://localhost:8000;
36
- proxy_http_version 1.1;
37
- proxy_set_header Upgrade $http_upgrade;
38
- proxy_set_header Connection "Upgrade";
39
- proxy_set_header Host $host;
40
- proxy_read_timeout 86400;
41
- }
42
-
43
- # Avatar TTS
44
- location /avatar/ {
45
- proxy_pass http://localhost:8765/;
46
- proxy_http_version 1.1;
47
- }
48
-
49
- # Avatar static files
50
- location /static/ {
51
- proxy_pass http://localhost:8765/static/;
52
- proxy_http_version 1.1;
53
- }
54
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
55
  }
 
1
+ user root;
2
+ worker_processes auto;
3
+ pid /tmp/nginx.pid;
4
+ error_log /tmp/nginx_error.log warn;
5
+
6
+ events {
7
+ worker_connections 1024;
8
+ }
9
+
10
+ http {
11
+ include /etc/nginx/mime.types;
12
+ default_type application/octet-stream;
13
+
14
+ access_log /tmp/nginx_access.log;
15
+
16
+ client_body_temp_path /tmp/client_body;
17
+ proxy_temp_path /tmp/proxy_temp;
18
+ fastcgi_temp_path /tmp/fastcgi_temp;
19
+ uwsgi_temp_path /tmp/uwsgi_temp;
20
+ scgi_temp_path /tmp/scgi_temp;
21
+
22
+ sendfile on;
23
+ keepalive_timeout 65;
24
+ client_max_body_size 100M;
25
+
26
+ # Main server on port 7860 (Hugging Face expects this)
27
+ server {
28
+ listen 7860;
29
+ server_name _;
30
+
31
+ # Frontend (Next.js)
32
+ location / {
33
+ proxy_pass http://localhost:3001;
34
+ proxy_http_version 1.1;
35
+ proxy_set_header Upgrade $http_upgrade;
36
+ proxy_set_header Connection 'upgrade';
37
+ proxy_set_header Host $host;
38
+ proxy_cache_bypass $http_upgrade;
39
+ }
40
+
41
+ # Backend WebSocket
42
+ location /ws {
43
+ proxy_pass http://localhost:8000;
44
+ proxy_http_version 1.1;
45
+ proxy_set_header Upgrade $http_upgrade;
46
+ proxy_set_header Connection "upgrade";
47
+ proxy_set_header Host $host;
48
+ proxy_read_timeout 86400;
49
+ }
50
+
51
+ # Backend API
52
+ location /api {
53
+ proxy_pass http://localhost:8000;
54
+ proxy_set_header Host $host;
55
+ proxy_set_header X-Real-IP $remote_addr;
56
+ }
57
+
58
+ # Avatar TTS
59
+ location /speak {
60
+ proxy_pass http://localhost:8765;
61
+ proxy_set_header Host $host;
62
+ }
63
+
64
+ location /static {
65
+ proxy_pass http://localhost:8765;
66
+ proxy_set_header Host $host;
67
+ }
68
+
69
+ # Health check
70
+ location /health {
71
+ proxy_pass http://localhost:8000/health;
72
+ proxy_set_header Host $host;
73
+ }
74
+ }
75
  }