nolascoin commited on
Commit
f92cdbd
·
1 Parent(s): 8ad7407

Final Nginx fix for HF

Browse files
Files changed (2) hide show
  1. Dockerfile +2 -8
  2. nginx.conf +18 -55
Dockerfile CHANGED
@@ -1,15 +1,9 @@
1
- # Use an official Nginx image to serve the static files
2
  FROM nginx:alpine-slim
3
 
4
- # Set the working directory inside the container
5
  WORKDIR /usr/share/nginx/html
6
 
7
- # Copy the production build from the dist folder to the Nginx HTML directory
8
  COPY dist/ .
 
 
9
 
10
- COPY nginx.conf /etc/nginx/conf.d/default.conf
11
-
12
- # Expose the default Nginx port
13
  EXPOSE 7860
14
-
15
- # Nginx runs by default, no need to specify CMD
 
 
1
  FROM nginx:alpine-slim
2
 
 
3
  WORKDIR /usr/share/nginx/html
4
 
 
5
  COPY dist/ .
6
+ COPY default.conf /etc/nginx/conf.d/default.conf
7
+ COPY nginx.conf /etc/nginx/nginx.conf
8
 
 
 
 
9
  EXPOSE 7860
 
 
nginx.conf CHANGED
@@ -1,61 +1,24 @@
1
- server {
2
- listen 7860;
3
- server_name localhost;
4
 
5
- root /usr/share/nginx/html;
6
- index index.html;
7
-
8
- # Enable gzip and pre-compressed file support
9
- gzip on;
10
- gzip_static on;
11
- gzip_comp_level 6;
12
- gzip_vary on;
13
- gzip_proxied any;
14
-
15
- gzip_types
16
- text/plain
17
- text/css
18
- text/javascript
19
- application/javascript
20
- application/json
21
- application/xml
22
- application/font-woff
23
- application/font-woff2
24
- application/octet-stream
25
- image/svg+xml;
26
-
27
- # Serve .gz files manually if needed
28
- location ~* \.gz$ {
29
- add_header Content-Encoding gzip;
30
- add_header Vary Accept-Encoding;
31
- types {
32
- text/javascript js;
33
- text/css css;
34
- text/html html;
35
- application/octet-stream glb;
36
- }
37
- }
38
 
39
- # 🔥 Cache-busting for fingerprinted assets
40
- location ~* \.(js|css|woff2?|eot|ttf|otf|svg|glb|gltf|wasm|png|jpe?g|gif|ico|webp)$ {
41
- add_header Cache-Control "public, max-age=31536000, immutable";
42
- try_files $uri =404;
43
- }
44
 
45
- # 🚫 Prevent caching index.html (always load latest)
46
- location = /index.html {
47
- add_header Cache-Control "no-cache";
48
- try_files $uri =404;
49
- }
 
50
 
51
- # 🧩 Optional: glb file support
52
- location ~* \.glb$ {
53
- add_header Content-Type application/octet-stream;
54
- try_files $uri =404;
55
- }
56
 
57
- # 🎯 SPA fallback (Vue/React/etc.)
58
- location / {
59
- try_files $uri $uri/ /index.html;
60
- }
61
  }
 
1
+ worker_processes auto;
2
+ error_log /var/log/nginx/error.log warn;
3
+ pid /tmp/nginx.pid;
4
 
5
+ events {
6
+ worker_connections 1024;
7
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8
 
9
+ http {
10
+ include /etc/nginx/mime.types;
11
+ default_type application/octet-stream;
 
 
12
 
13
+ # Use /tmp as a safe temp directory for Hugging Face
14
+ client_body_temp_path /tmp/client_temp;
15
+ proxy_temp_path /tmp/proxy_temp;
16
+ fastcgi_temp_path /tmp/fastcgi_temp;
17
+ uwsgi_temp_path /tmp/uwsgi_temp;
18
+ scgi_temp_path /tmp/scgi_temp;
19
 
20
+ sendfile on;
21
+ keepalive_timeout 65;
 
 
 
22
 
23
+ include /etc/nginx/conf.d/*.conf;
 
 
 
24
  }