title: Nginx downloads PHP files instead of showing them (not a socket issue)
body: <p>So I am setting up my first Linode (sort of new to managing everything myself). However, I have the following problem. The browser downloads the php file instead of executing it and MS Internet Explorer shows the file's content instead of downloading it.</p>
  
  <p>I've read through a lot of content/answers about this problem but nothing seems works so I'd appreciate your help.</p>
  
  <p>Important to note is that the website "crashes" only when I add the following line to the Virtual Host file</p>
  
  <p><code>location ~* .(ico|jpg|webp|jpeg|gif|css|png|js|ico|bmp|zip|woff)$ {
  expires 365d;
  }</code></p>
  
  <p>Here are the two files in full
  <strong>NGINX.CONF</strong></p>
  
  <pre><code>user www-data;
  worker_processes 4;
  pid /run/nginx.pid;
  
  events {
  worker_connections 768;
  multi_accept on;
  }
  
  http {
  
  ##
  # Basic Settings
  ##
  
  sendfile on;
  tcp_nopush on;
  tcp_nodelay on;
  keepalive_timeout 10s;
  types_hash_max_size 2048;
  # server_tokens off;
  
  server_names_hash_bucket_size 64;
  # server_name_in_redirect off;
  
  include /etc/nginx/mime.types;
  default_type application/octet-stream;
  
  ##
  # SSL Settings
  ##
  
  # ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE
  # ssl_prefer_server_ciphers on;
  
  ##
  # Logging Settings
  ##
  
  access_log /var/log/nginx/access.log;
  error_log /var/log/nginx/error.log debug;
  
  ##
  # Gzip Settings
  ##
  
  gzip on;
  gzip_disable "msie6";
  
  
  gzip_vary on;
  gzip_proxied any;
  gzip_comp_level 6;
  gzip_buffers 16 8k;
  gzip_http_version 1.1;
  gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
  
  ##
  # Virtual Host Configs
  ##
  
  include /etc/nginx/conf.d/*.conf;
  include /etc/nginx/sites-enabled/*;
  
  }
  </code></pre>
  
  <p><strong>and the sites-available/default file</strong></p>
  
  <pre><code>server {
  listen 80 default_server;
  listen [::]:80 default_server;
  
  root /www/bloggingwithdani.com;
  
  index index.html index.php index.htm;
  
  server_name localhost;
  
  # pagespeed On;
  # pagespeed FileCachePath "/var/cache/ngx_pagespeed/";
  # pagespeed EnableFilters combine_css,combine_javascript;
  
  location / {
  try_files $uri $uri/ /index.php?$args;
  }
  error_page 404 /404.html;
  error_page 500 502 503 504 /50x.html;
  location = /50x.html {
  root /usr/share/nginx/html;
  }
  
  location ~* .(ico|jpg|webp|jpeg|gif|png|ico|bmp|zip|woff|css|js|)$ {
  expires 365d;
  }
  
  
  location ~ /\. {
  deny all;
  }
  
  location ~* /(?:uploads|files)/.*\.php$ {
  deny all;
  }
  
  location ~ [^/]\.php(/|$) {
  try_files $uri =404;
  fastcgi_split_path_info ^(.+\.php)(/.+)$;
  if (!-f $document_root$fastcgi_script_name) {
  return 404;
  }
  fastcgi_pass unix:/var/run/php5-fpm.sock;
  fastcgi_index index.php;
  fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  include fastcgi_params;
  
  }
  
  }
  </code></pre>