使用Symfony2 Nginx和PHP-FPM丢失堆栈跟踪

时间:2013-02-22 15:01:13

标签: symfony nginx php

我最近从Apache / fastCgi切换到Nginx / FPM配置。 到目前为止,一切都运行良好,除了Symfony2 Stack trace。

当我使用Nginx时,我得到正常的错误输出。当我使用Apache时,我获得了Symfony2的美化StackTrace输出。由于缺少StackTrace,我的开发人员开始踢我的屁股。我查看了我能想象到的每个配置文件(php.ini,vhost配置,fpm配置),似乎没有错误。可能有些人可以给我一个提示。

Nginx-Vhost配置:

    server {
    listen 80;
    root /var/www/mirco/htdocs/public/sp2/web;
    server_name api.sp2.mirco.esg.com;
    error_log /var/www/mirco/logs/error-sp_api.log;
    access_log /var/www/mirco/logs/access-sp_api.log;

    # strip api.php/ prefix if it is present
    rewrite ^/api\.php/?(.*)$ /$1 permanent;

    # remove trailing slashes
    rewrite ^/(.*)/$ /$1 permanent;

    location / {
        index api.php;
        try_files $uri @rewriteapp;
    }

    location @rewriteapp {
        rewrite ^(.*)$ /api.php/$1 last;
    }

    location ~ ^/(t|api|api_dev)\.php(/|$) {
        fastcgi_split_path_info ^(.+\.php)(/.*)$;
        fastcgi_pass unix:/var/run/php-fpm.mirco.sock;

        fastcgi_param  SCRIPT_FILENAME    $document_root$fastcgi_script_name;
        fastcgi_param  SYMFONY_ENV        api_mirco;
        include fastcgi_params;
    }
   }

Nginx-Main配置

    user www-data;
  worker_processes 4;
  pid /var/run/nginx.pid;

  events {
        worker_connections 768;
        # multi_accept on;
  }

http {

        ##
        # Basic Settings
        ##

        sendfile on;
        tcp_nopush on;
        tcp_nodelay on;
        keepalive_timeout 300;
        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;

        ##
        # Logging Settings
        ##

        access_log /var/log/nginx/access.log;
        error_log /var/log/nginx/error.log;
        rewrite_log on;

        ##
        # 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/x-javascript text/xml application/xml application/xml+rss text/javascript;

        ##
        # nginx-naxsi config
        ##
        # Uncomment it if you installed nginx-naxsi
        ##

        #include /etc/nginx/naxsi_core.rules;

        ##
        # nginx-passenger config
        ##
        # Uncomment it if you installed nginx-passenger
        ##

        #passenger_root /usr;
        #passenger_ruby /usr/bin/ruby;

  perl_modules perl/lib;

  perl_set $uri_lowercase 'sub {
  my $r = shift;
  my $uri = $r->uri;
  $uri = lc($uri);
  return $uri;
  }';

        ##
        # Virtual Host Configs
        ##

        include /etc/nginx/conf.d/*.conf;
        include /etc/nginx/sites-enabled/*;
}

1 个答案:

答案 0 :(得分:0)

检查一下: http://wiki.nginx.org/Symfony

并可能尝试更改此内容:

ini_set('display_errors', 'On');

最好还是在php.ini

中更改它