dsh8009271 2015-07-14 10:39
浏览 102

Facebook SDKV4无法登录 - Nginx PHP-FPM

My localhost website is working perfectly using Facebook SDKV4 on Apache. But after migration to Nginx PHP-FPM I cannot login anymore. All Facebook app config is the same nothing is change except for my local server.

I'm new to nginx I searched a lot and did not found anything about what I'm missing.

Here's my Nginx Site Config:

server {
    listen       80;
    listen [::]:80 ipv6only=on;

    server_name  localhost;

    root       /webroot/site/public_html;

    index  index.php index.html index.htm default.html default.htm;

    access_log  /webroot/site/app/logs/access.log;

    error_log   /webroot/site/app/logs/error.log;

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

    location ~ \.php$ {        

        fastcgi_param PATH_INFO $fastcgi_path_info;
        fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

        fastcgi_pass 127.0.0.1:9000;
        fastcgi_index index.php;
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_intercept_errors on;
        include fastcgi_params;        
    }    
}

I think it has something to do with the session. Does anyone experience this problem before? any clue will help.

My System: php-fpm 5.6, nginx-1.9.2 installed using homebrew

It seems that my problem is related to this question Sessions are Missing With Facebook PHP Sdk (Nginx Php-Fpm)
I cannot reply to that question.

Update: It turns out that csrf_token is not created on session using my nginx php-fpm 5.6 local server. I tried using my apache (XAMPP) server csrf_token is created and able to login. I still don't know whats wrong with my configuration. any clue will help.

  • 写回答

1条回答 默认 最新

  • dourangdz750379 2015-07-15 22:41
    关注

    I figure it out!

    The Problem is I'm not able to get the url parameters or arguments. In my Virtual Host Config I change my URL rewriting to:

    try_files $uri $uri/ /index.php?$args;

    To get the Full URL including the parameters eg. index.php?q=1234

    It is also very important to use SERVER Variables to fetch urls instead of using GET.

    I wasted 1 day figuring this out :( So there you go if anyone experience this.

    评论

报告相同问题?

悬赏问题

  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥15 c++头文件不能识别CDialog