Facebook SDKV4无法登录 - Nginx PHP-FPM

我的localhost网站在Apache上使用Facebook SDKV4完美运行。 但是在迁移到Nginx PHP-FPM之后我再也无法登录了。 所有的Facebook应用程序配置都是一样的,除了我的本地服务器之外什么也没有变化。</ p>

我是nginx的新手,我搜索了很多,没有找到任何关于我缺少的东西。< 这是我的Nginx站点配置:</ p>

  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;
nn location / {
try_files $ uri $ uri / /index.php?q=$uri ;
}

位置〜\ .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;
包括fastcgi_params;

}
}
</ code> </ pre>

我认为这与会话有关。 有没有人以前遇到过这个问题? 任何线索都会有所帮助。</ p>

我的系统:使用自制软件安装的php-fpm 5.6,nginx-1.9.2 </ p>

看来我的问题是相关的 对于这个问题会话缺少Facebook PHP Sdk(Nginx) Php-Fpm)

我无法回答这个问题。 </ p>

更新:
结果是使用我的nginx php-fpm 5.6本地服务器在会话中没有创建csrf_token。 我尝试使用我的apache(XAMPP)服务器创建csrf_token并能够登录。 我仍然不知道我的配置有什么问题。 任何线索都会有所帮助。</ p>
</ div>

展开原文

原文

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个回答



我弄清楚了! </ p>

问题是我无法获取url参数或参数。 在我的虚拟主机配置中,我将URL重写更改为:</ p>

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


nn

要获取 完整的URL包括参数,例如。 index.php?q = 1234 </ p>

使用SERVER变量来获取网址而不是使用GET也非常重要。</ p>

我浪费了1天 搞清楚这一点:(如果有人遇到这种情况你就去吧。</ p>
</ div>

展开原文

原文

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.

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问