Final Nginx fix for HF
Browse files- Dockerfile +2 -8
- 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 |
-
|
| 2 |
-
|
| 3 |
-
|
| 4 |
|
| 5 |
-
|
| 6 |
-
|
| 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 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
try_files $uri =404;
|
| 43 |
-
}
|
| 44 |
|
| 45 |
-
#
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
|
|
|
| 50 |
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
add_header Content-Type application/octet-stream;
|
| 54 |
-
try_files $uri =404;
|
| 55 |
-
}
|
| 56 |
|
| 57 |
-
|
| 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 |
}
|