4

我最近从 Apache/fastCgi 切换到 Nginx/FPM 配置。到目前为止一切正常,除了 Symfony2 Stack 跟踪。

当我使用 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-主配置

    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/*;
}
4

1 回答 1

0

检查这个: http ://wiki.nginx.org/Symfony

并可能尝试改变这一点:

ini_set('display_errors', 'On');

最好还是在 php.ini 中更改它

于 2013-03-12T07:32:39.413 回答