root /home/u1/domains/example.com;

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

location /docs {
  if ($request_uri ~* (^\/|\.js|\.css|\.jpg|\.gif|\.png|\.html)$ ) {
    break;
  }
  return 403;
}

location /editors {
  if ($request_uri ~* (^\/|\.js|\.css|\.jpg|\.gif|\.png|\.html|\.xml)$ ) {
    break;
  }
  return 403;
}

location /email {
  if ($request_uri ~* (^\/|\.jpg|\.JPG|\.jpeg|\.JPEG|\.gif|\.GIF|\.png|\.PNG)$ ) {
    break;
  }
  return 403;
}

location /extras {
  if ($request_uri ~* (^\/|\.php|\.html)$ ) {
    break;
  }
  return 403;
}

location /images {
  if ($request_uri ~* (^\/|\.jpg|\.JPG|\.jpeg|\.JPEG|\.gif|\.GIF|\.png|\.PNG|\.swf|\.SWF|\.WMA)$) {
    break;
  }
  return 403;
}

location /(download|pub) {
  if ($request_uri ~* (^\/|\.zip|\.ZIP|\.gzip|\.pdf|\.PDF|\.mp3|\.MP3|\.swf|\.SWF|\.wma|\.WMA|\.wmv|\.WMV)$) {
    break;
  }
  return 403;
}

location /includes {
  if ($request_uri ~* (^\/|\.js|\.JS|\.css|\.CSS|\.jpg|\.JPG|\.gif|\.GIF|\.png|\.PNG|\.swf|\.SWF|\.xsl|\.XSL)$) {
    break;
  }
  return 403;
}

location /media {
  if ($request_uri ~* (^\/|\.mp3|\.mp4|\.swf|\.avi|\.mpg|\.wma|\.rm|\.ra|\.ram|\.wmv)$) {
    break;
  }
  return 403;
}

location /admin {
  if ($request_uri ~* (^\/|\.php|\.js|\.css|\.jpg|\.gif|\.png)$) {
    break;
  }
  return 403;
}

location = /robots.txt  {
  access_log off;
  log_not_found off;
}

location = /favicon.ico {
  access_log off;
  error_log off;
  log_not_found off;
}

location ~ /\. {
  deny all;
}

location ~* \.php$ {
  fastcgi_pass unix:/var/run/php5-example.com.sock;
  fastcgi_index index.php;
  fastcgi_split_path_info ^(.+\.php)(.*)$;
  include fastcgi_params;
  fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
