server { listen 80 default_server; root /opt/una; client_max_body_size 200M; # Compress text responses. HTML is compressed whenever gzip is on; the # types below add CSS/JS/JSON/SVG. Already-compressed responses (the # gzip_loader.php bundles, which set Content-Encoding themselves, and # woff2 fonts) are left untouched by nginx. gzip on; gzip_vary on; gzip_proxied any; gzip_comp_level 5; gzip_min_length 256; gzip_types text/plain text/css text/xml application/javascript text/javascript application/json application/xml image/svg+xml application/manifest+json application/wasm; location / { index index.html index.htm index.php; rewrite "^/page/(.*)$" /page.php?i=$1 last; rewrite "^/m/(.*)$" /modules/index.php?r=$1 last; rewrite "^/s/([a-zA-Z0-9_]+)/([a-zA-Z0-9\.]+)" /storage.php?o=$1&f=$2 last; if (!-e $request_filename) { rewrite ^/(.+)$ /r.php?_q=$1 last; break; } } # Long-lived caching for real static files. Virtual paths that merely end # in an asset extension (/s//.png served by storage.php, or a # missing file routed through r.php) are not files on disk, so try_files # hands them to @dynamic instead of 404ing. location ~* \.(?:woff2?|ttf|otf|eot|svg|png|jpe?g|gif|webp|avif|ico|css|js|mjs|map)$ { try_files $uri @dynamic; expires 30d; add_header Cache-Control "public"; access_log off; } location @dynamic { rewrite "^/s/([a-zA-Z0-9_]+)/([a-zA-Z0-9\.]+)" /storage.php?o=$1&f=$2 last; rewrite ^/(.+)$ /r.php?_q=$1 last; } index index.php index.html index.htm; location ~ \.php$ { fastcgi_pass php:9000; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } }