Spaces:
Running
Running
“vinit5112”
commited on
Commit
·
9f242de
1
Parent(s):
7d75dab
fix: nginx temp dirs and permission fix for Hugging Face
Browse files- frontend/nginx.conf +14 -6
frontend/nginx.conf
CHANGED
@@ -1,3 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
server {
|
2 |
listen 7860;
|
3 |
|
@@ -10,20 +20,18 @@ server {
|
|
10 |
try_files $uri /index.html;
|
11 |
}
|
12 |
|
13 |
-
# Proxy API requests to the backend
|
14 |
-
# Any request to http://<your-space-url>/api/...
|
15 |
-
# will be forwarded to http://backend:8000/...
|
16 |
location /api {
|
17 |
-
proxy_pass http://127.0.0.1:8000;
|
18 |
proxy_set_header Host $host;
|
19 |
proxy_set_header X-Real-IP $remote_addr;
|
20 |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
21 |
proxy_set_header X-Forwarded-Proto $scheme;
|
22 |
}
|
23 |
|
24 |
-
#
|
25 |
location ~* \.(css|js|jpg|jpeg|png|gif|ico|svg)$ {
|
26 |
expires 1y;
|
27 |
add_header Cache-Control "public";
|
28 |
}
|
29 |
-
}
|
|
|
1 |
+
# Remove or comment out `user` directive if it's elsewhere
|
2 |
+
# user nginx;
|
3 |
+
|
4 |
+
# Set custom temp directories to avoid permission errors
|
5 |
+
client_body_temp_path /app/tmp/body;
|
6 |
+
proxy_temp_path /app/tmp/proxy;
|
7 |
+
fastcgi_temp_path /app/tmp/fastcgi;
|
8 |
+
uwsgi_temp_path /app/tmp/uwsgi;
|
9 |
+
scgi_temp_path /app/tmp/scgi;
|
10 |
+
|
11 |
server {
|
12 |
listen 7860;
|
13 |
|
|
|
20 |
try_files $uri /index.html;
|
21 |
}
|
22 |
|
23 |
+
# Proxy API requests to the backend
|
|
|
|
|
24 |
location /api {
|
25 |
+
proxy_pass http://127.0.0.1:8000;
|
26 |
proxy_set_header Host $host;
|
27 |
proxy_set_header X-Real-IP $remote_addr;
|
28 |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
29 |
proxy_set_header X-Forwarded-Proto $scheme;
|
30 |
}
|
31 |
|
32 |
+
# Cache static assets
|
33 |
location ~* \.(css|js|jpg|jpeg|png|gif|ico|svg)$ {
|
34 |
expires 1y;
|
35 |
add_header Cache-Control "public";
|
36 |
}
|
37 |
+
}
|