# HTTP-only bootstrapping config (used before SSL certs are obtained)
server {
    listen 80 default_server;
    server_name fleety.ghomsoft.com _;

    root /var/www/html/public;
    index index.php;

    charset utf-8;

    # Security headers
    add_header X-Frame-Options "SAMEORIGIN" always;
    add_header X-Content-Type-Options "nosniff" always;
    add_header X-XSS-Protection "1; mode=block" always;
    add_header Referrer-Policy "strict-origin-when-cross-origin" always;

    gzip on;
    gzip_vary on;
    gzip_proxied any;
    gzip_comp_level 6;
    gzip_types text/plain text/css text/xml application/json application/javascript application/xml+rss image/svg+xml;

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

    location ~ \.php$ {
        fastcgi_pass php:9000;
        fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
        include fastcgi_params;
        internal;
    }

    location ~ /\.(ht|git|env) {
        deny all;
    }

    location ~ ^/build/ {
        expires 1y;
        add_header Cache-Control "public, immutable";
    }

    location ~ ^/uploads/ {
        expires 30d;
    }

    access_log /var/log/nginx/access.log;
    error_log /var/log/nginx/error.log;
}
