Files
photocraft/packaging/web/nginx.conf
T
Filip PłachecińskiandClaude Opus 5.5 f0ae12dd22 Self-host the web app with Docker (nginx, community-maintained) (#1334)
A multi-stage Dockerfile builds photocraft-web with Trunk and serves dist/web from an
unprivileged nginx on :8080, with /healthz, precompressed gzip, the wasm MIME type and
immutable hashed assets. Rust and Trunk follow the release workflow, and the
PHOTOCRAFT_BUILD_SHA/DATE build args stamp About. Documented in packaging/web/README.md;
not built in CI.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-08 23:10:55 -04:00

59 lines
1.6 KiB
Nginx Configuration File

worker_processes auto;
pid /tmp/nginx.pid;
error_log /dev/stderr warn;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
access_log /dev/stdout;
sendfile on;
server_tokens off;
# All runtime writes go to /tmp, allowing a read-only container filesystem.
client_body_temp_path /tmp/client_temp;
proxy_temp_path /tmp/proxy_temp;
fastcgi_temp_path /tmp/fastcgi_temp;
uwsgi_temp_path /tmp/uwsgi_temp;
scgi_temp_path /tmp/scgi_temp;
# Precompressed at build time; uncompressed clients receive the original.
gzip_static on;
gzip_vary on;
server {
listen 8080;
listen [::]:8080;
root /usr/share/nginx/html;
index index.html;
add_header X-Content-Type-Options nosniff always;
location = /healthz {
access_log off;
default_type text/plain;
return 200 "ok\n";
}
location = /index.html {
add_header Cache-Control no-cache always;
add_header X-Content-Type-Options nosniff always;
}
# Trunk gives these files content hashes. Missing assets must be 404s,
# never an HTML fallback or an error cached for a year.
location ~ \.(wasm|js)$ {
types { application/wasm wasm; text/javascript js; }
add_header Cache-Control "public, max-age=31536000, immutable";
add_header X-Content-Type-Options nosniff always;
try_files $uri =404;
}
location / {
try_files $uri $uri/ =404;
}
}
}