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.

    评论

报告相同问题?

悬赏问题

  • ¥30 求一段fortran代码用IVF编译运行的结果
  • ¥15 深度学习根据CNN网络模型,搭建BP模型并训练MNIST数据集
  • ¥15 lammps拉伸应力应变曲线分析
  • ¥15 C++ 头文件/宏冲突问题解决
  • ¥15 用comsol模拟大气湍流通过底部加热(温度不同)的腔体
  • ¥50 安卓adb backup备份子用户应用数据失败
  • ¥20 有人能用聚类分析帮我分析一下文本内容嘛
  • ¥15 请问Lammps做复合材料拉伸模拟,应力应变曲线问题
  • ¥30 python代码,帮调试,帮帮忙吧
  • ¥15 #MATLAB仿真#车辆换道路径规划