Nginx为hybridauth返回url显示502坏网关

When I access www.mydomain.com/lib/hybridauth/index.php I see the contents of the page, no problems. After logging in with Facebook using HybridAuth, it redirects to the same url but with url parameters passed (www.mydomain.com/lib/hybridauth/index.php??hauth.done=Facebook&code=some-value&state=somevalue#=). Nginx gives me a 502 bad request if the same url has url parameters. How can I handle prevent this?

server {
listen       80;
server_name  www.mydomain.com;

root   /var/www/html/mydomain;

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

location ~ [^/]\.php(/|$) {
    fastcgi_split_path_info ^(.+?\.php)(/.*)$;
    if (!-f $document_root$fastcgi_script_name) {
        return 404;
    }

    fastcgi_pass 127.0.0.1:9000;
    fastcgi_index index.php;
    include fastcgi.conf;
}

location ~ /\.ht {
    deny  all;
  }

}

I seem to fix this problem by disabling opcache in php.ini.