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 c程序不知道为什么得不到结果
  • ¥40 复杂的限制性的商函数处理
  • ¥15 程序不包含适用于入口点的静态Main方法
  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置