charset utf-8;
client_max_body_size 128M;
sendfile off;

listen 80;

# Add index.php to the list if you are using PHP
index index.php;

location / {
  # First attempt to serve request as file, then
  # as directory, then fall back to displaying a 404.
  try_files $uri $uri/ /index.php$is_args$args;
}

# uncomment to avoid processing of calls to non-existing static files by Yii
location ~ \.(js|css|png|jpg|gif|swf|ico|pdf|mov|fla|zip|rar)$ {
  try_files $uri =404;
}
error_page 404 /404.html;

# deny accessing php file for assets
location ~ ^/assets/.*\.php$ {
        deny all;
}

# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
  include fastcgi_params;
  fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  fastcgi_read_timeout 600;

  fastcgi_pass unix:/run/php/php8.1-fpm.sock;
  try_files $uri =404;
}

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

location ~* /\. {
  deny all;
}
