Files
HMCL-docs/nginx.conf
2026-11-02 17:06:03 +08:00

41 lines
1.1 KiB
Nginx Configuration File

worker_processes auto;
pid /tmp/nginx.pid;
error_log /dev/stderr warn;
events { worker_connections 512; }
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
access_log /dev/stdout;
server_tokens off;
sendfile on;
keepalive_timeout 30;
client_body_temp_path /tmp/client;
proxy_temp_path /tmp/proxy;
fastcgi_temp_path /tmp/fastcgi;
uwsgi_temp_path /tmp/uwsgi;
scgi_temp_path /tmp/scgi;
server {
listen 8080;
server_name _;
root /srv/www;
index index.html;
absolute_redirect off;
autoindex off;
error_page 404 /404.html;
add_header X-Content-Type-Options nosniff always;
add_header Cache-Control "no-cache" always;
location / { try_files $uri $uri/ =404; }
# Preserve legacy generated-image URLs without storing converted images.
location ~ ^/assets/.+\.(?:png|jpe?g|gif|tiff?)\.webp$ {
try_files $uri @original_image;
}
location @original_image {
rewrite ^(/assets/.+\.(?:png|jpe?g|gif|tiff?))\.webp$ $1 permanent;
}
location ~ /\. { deny all; }
}
}