Spaces:
Running
Running
Create conf/nginx.conf
Browse files- conf/nginx.conf +48 -0
conf/nginx.conf
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#this gets copied into the nginx settings during space creation... see dockerfile
|
| 2 |
+
|
| 3 |
+
server {
|
| 4 |
+
listen 7860;
|
| 5 |
+
server_name localhost;
|
| 6 |
+
|
| 7 |
+
# Specific to HF Spaces: Allow larger headers for their proxy setup
|
| 8 |
+
large_client_header_buffers 4 32k;
|
| 9 |
+
|
| 10 |
+
proxy_connect_timeout 600;
|
| 11 |
+
proxy_send_timeout 600;
|
| 12 |
+
proxy_read_timeout 600;
|
| 13 |
+
send_timeout 600;
|
| 14 |
+
|
| 15 |
+
# Additional headers specific to running behind HF Spaces proxy
|
| 16 |
+
proxy_set_header Host $host;
|
| 17 |
+
proxy_set_header X-Real-IP $remote_addr;
|
| 18 |
+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
| 19 |
+
proxy_set_header X-Forwarded-Proto $scheme;
|
| 20 |
+
proxy_set_header X-Forwarded-Host $host;
|
| 21 |
+
|
| 22 |
+
client_max_body_size 50M;
|
| 23 |
+
|
| 24 |
+
# the node.js api runs on localhost:6666
|
| 25 |
+
# here we tell nginx that requests to /API should forward there
|
| 26 |
+
location /api/ {
|
| 27 |
+
#rewrite ^/API/images/(.*) /$1 break;
|
| 28 |
+
proxy_pass http://localhost:6666;
|
| 29 |
+
proxy_buffering on;
|
| 30 |
+
proxy_buffer_size 128k;
|
| 31 |
+
proxy_buffers 4 256k;
|
| 32 |
+
proxy_busy_buffers_size 256k;
|
| 33 |
+
}
|
| 34 |
+
|
| 35 |
+
#location /API/tts/ {
|
| 36 |
+
# rewrite ^/API/tts/(.*) /$1 break;
|
| 37 |
+
# proxy_pass http://localhost:5555;
|
| 38 |
+
# proxy_http_version 1.1;
|
| 39 |
+
# proxy_set_header Upgrade $http_upgrade;
|
| 40 |
+
# proxy_set_header Connection "upgrade";
|
| 41 |
+
#}
|
| 42 |
+
|
| 43 |
+
# Required for HF Spaces health checks
|
| 44 |
+
location / {
|
| 45 |
+
return 200 'OK';
|
| 46 |
+
add_header Content-Type text/plain;
|
| 47 |
+
}
|
| 48 |
+
}
|