Categories
Linux PHP

Kohana nginx config

I was driving me nuts to get a functional nginx config that worked…

index index.php;

# Don't serve hidden files.
location ~ /\. {
    deny all;
}

location = /favicon.ico {
    log_not_found off;
}

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

location ~ \.php$ {
  include       fastcgi_params;
  fastcgi_index index.php;
  fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

  fastcgi_param KOHANA_ENV PRODUCTION;


  # YOU MUST REPLACE 12345 with your app's PHP FPM port number
  ############################################################
  fastcgi_pass  127.0.0.1:10815;
  
  # Prevent arbitrary code execution by third parties with
  # try_files directive.
  # http://wiki.nginx.org/Pitfalls#Passing_Uncontrolled_Requests_to_PHP
  try_files     $uri =404;
}