server {
    listen 8080;
    listen [::]:8080;
    server_name "";

    root /assets/data;
    index index.php index.html index.htm index.default.php;

    rewrite ^/content/(.*)\.(txt|md|mdown)$ /index.php last;
    rewrite ^/site/(.*) /index.php last;
    rewrite ^/kirby/(.*) /index.php last;

    access_log /assets/logs/access.log;
    error_log /assets/logs/error.log;

    client_max_body_size 250M;

    location / {
        try_files $uri $uri/ /index.php$is_args$args;
    }

    location ~* \.php$ {
        try_files $uri =404;
        fastcgi_pass unix:/var/run/php/php8.1-fpm-tooloop.sock;
        include fastcgi.conf;
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_param PATH_INFO $fastcgi_path_info;
        fastcgi_param PHP_VALUE "upload_max_filesize=250M;\n post_max_size=250M;\n error_reporting=E_ALL;";
     }

    location ~ /\.ht {
        deny all;
    }

    # location ~* \.(?:jpg|jpeg|gif|png|webp|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm|htc|js|css|json|otf|ttf)$ {
    #     etag on;
    #     expires 1M;
    #     if_modified_since exact;
    #     add_header Pragma "public";
    #     add_header Cache-Control "public, max-age=31536000,no-transform";
    # }
}
