title: Getting error 502 instead of displaying errors on nginx + php-fpm
body: <p>I've tried everything and i can't still get to display errors on the browser, I'm using nginx, php-fpm and centOS 6.4</p>
  
  <p>nginx.conf</p>
  
  <pre><code>user  nginx;
  worker_processes  1;
  
  error_log  /var/log/nginx/error.log warn;
  pid        /var/run/nginx.pid;
  
  
  events {
      worker_connections  1024;
  }
  
  http {
      include       /etc/nginx/mime.types;
      default_type  application/octet-stream;
  
      log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                        '$status $body_bytes_sent "$http_referer" '
                        '"$http_user_agent" "$http_x_forwarded_for"';
  
      access_log  /var/log/nginx/access.log  main;
  
      sendfile        on;
      #tcp_nopush     on;
  
      keepalive_timeout  65;
  
      #gzip  on;
  
      include /etc/nginx/conf.d/*.conf;
  }
  </code></pre>
  
  <p>this is my nginx config inside conf.d</p>
  
  <pre><code>server {
  listen       80;
  server_name  localhost;
  root /server/public;
  index run.php;
  
  
  location / {
      try_files $uri $uri/ /run.php;
  }
  
  location ~ \.php$ {
      fastcgi_index   run.php;
      fastcgi_pass    127.0.0.1:9000;
      include         fastcgi_params;
      fastcgi_param   SCRIPT_FILENAME $document_root$fastcgi_script_name;
      }
  }
  </code></pre>
  
  <p>php-fpm config</p>
  
  <pre><code>catch_workers_output = yes
  php_flag[display_errors] = on
  php_admin_flag[log_errors] = on
  </code></pre>
  
  <p>php.ini</p>
  
  <pre><code>display_errors = on
  log_errors = on
  </code></pre>
  
  <p>I'm running CentOS 6.4 on virtualbox with NAT enabled, if i curl localhost from inside the server i get the correct error but if i access the site from the browser outside of the server i get a 502 bad gateway error, if the page I'm loading has no errors everything works fine, am I missing anything?</p>