2

通过 OAuth 进行身份验证时,Facebook 重定向到 localhost 而不是我的域。我正在使用 django-allauth 进行 facebook 身份验证。GitHub 上有人指出错误可能出在 Nginx 配置中。我在下面粘贴我的 nginx 配置:

server { # simple reverse-proxy
    listen       80;
    server_name  subdomain.domain.com;
    access_log   logs/site.access.log;

    # serve static files
    location ~ ^/static/  {
        root    /home/user_name/site_assets/;
        expires 30d;
    }

    # serve media files
    location ~ ^/media/(images|javascript|js|css|flash|img)/  {
        root    /home/user_name/site_assets/;
        expires 30d;
    }

    # pass requests for dynamic content to rails/turbogears/zope, et al
    location / {
        proxy_pass      http://localhost:8000;    
    }
  }

有人可以澄清我在这里缺少什么吗?

4

1 回答 1

6

经过一番折腾,终于找到了。Nginx 配置应该有这个额外的行。 proxy_set_header Host $http_host; 所以最终的 Nginx 配置应该如下所示:

server { # simple reverse-proxy
    listen       80;
    server_name  subdomain.domain.com;
    access_log   logs/site.access.log;

    # serve static files
    location ~ ^/static/  {
        root    /home/user_name/site_assets/;
        expires 30d;
    }

    # serve media files
    location ~ ^/media/(images|javascript|js|css|flash|img)/  {
        root    /home/user_name/site_assets/;
        expires 30d;
    }

    # pass requests for dynamic content to rails/turbogears/zope, et al
    location / {
        proxy_set_header Host $http_host;
        proxy_pass      http://localhost:8000;    
    }
}

于 2013-05-12T14:55:44.463 回答