server {
  server_name default;
  root        /var/www/public;
  index       main.php;

  client_max_body_size 100M;
  fastcgi_read_timeout 1800;

  location / {
    try_files $uri $uri.html $uri/ @extensionless-php;
  }

  location @extensionless-php {
    rewrite ^(.*)$ $1.php last;
  }

  location /status {
     access_log off;
     allow 172.17.0.0/16;
     deny all;
     include /etc/nginx/fastcgi_params;
     fastcgi_param SCRIPT_FILENAME /status;
     fastcgi_pass unix:/var/run/php5-fpm.sock;
  }

  location /ping {
     access_log off;
     allow all;
     include fastcgi_params;
     fastcgi_param SCRIPT_FILENAME /ping;
     fastcgi_pass unix:/Var/run/php5-fpm.sock;
  }

  location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
    expires       max;
    log_not_found off;
    access_log    off;
  }

  location ~ \.php$ {
    try_files     $uri =404;
    include       fastcgi_params;
    fastcgi_index index.php;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    fastcgi_pass  unix:/var/run/php5-fpm.sock;
  }
}
