# Libro.az — пример конфигурации nginx (VPS)
# Оба домена (libro.az и app.libro.az) указывают на ОДИН document root = public/

server {
    listen 80;
    server_name libro.az www.libro.az app.libro.az;

    root /var/www/libro.az/public;
    index index.php index.html;
    charset utf-8;

    client_max_body_size 20m;

    add_header X-Frame-Options "SAMEORIGIN";
    add_header X-Content-Type-Options "nosniff";

    location / {
        try_files $uri $uri/ /index.php?$query_string;
    }

    location ~ \.php$ {
        fastcgi_pass unix:/var/run/php/php8.3-fpm.sock;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;
    }

    location ~ /\.(?!well-known).* {
        deny all;
    }

    # Статика — долгий кэш
    location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ {
        expires 1y;
        add_header Cache-Control "public, immutable";
        try_files $uri =404;
    }
}
