Node build on hi/nodejs:22-builder, the nginx config checked with `nginx -t` on hi/nginx:latest-builder, served by the distroless hi/nginx runtime (UID 65532, no shell). nginx keeps temp files in /tmp so the pod can run with a read-only root filesystem; adds nosniff/referrer headers and hides the nginx version. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+22
-6
@@ -1,20 +1,36 @@
|
||||
# The Atlas is plain static files. The data changes daily, so browsers revalidate rather than cache blindly.
|
||||
# Replaces the image's conf.d/default.conf (it listens on 8080 and runs as UID 65532).
|
||||
|
||||
# Temp files under /tmp (an emptyDir in the pod), so the root filesystem can be read-only
|
||||
client_body_temp_path /tmp/client_body;
|
||||
proxy_temp_path /tmp/proxy;
|
||||
fastcgi_temp_path /tmp/fastcgi;
|
||||
uwsgi_temp_path /tmp/uwsgi;
|
||||
scgi_temp_path /tmp/scgi;
|
||||
|
||||
server {
|
||||
listen 8080;
|
||||
root /usr/share/nginx/html;
|
||||
index index.html;
|
||||
charset utf-8;
|
||||
server_tokens off;
|
||||
|
||||
types {
|
||||
text/plain yaml py csv;
|
||||
}
|
||||
# The image logs to files under /var/log/nginx; send access logs to the pod log instead
|
||||
access_log /dev/stdout main;
|
||||
|
||||
# Show the page's data and source files as text (in server context this replaces the inherited types)
|
||||
include /etc/nginx/mime.types;
|
||||
types {
|
||||
text/plain yaml py;
|
||||
}
|
||||
|
||||
gzip on;
|
||||
gzip_types text/plain text/css application/javascript application/json text/csv;
|
||||
gzip_types text/plain text/css text/csv text/javascript application/javascript application/json;
|
||||
|
||||
add_header Cache-Control "no-cache";
|
||||
add_header Cache-Control "no-cache" always;
|
||||
add_header X-Content-Type-Options "nosniff" always;
|
||||
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
|
||||
|
||||
location = /healthz { access_log off; return 200 "ok\n"; }
|
||||
location = /healthz { access_log off; default_type text/plain; return 200 "ok\n"; }
|
||||
location / { try_files $uri $uri/ =404; }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user