通过OAuth进行身份验证时,Facebook会重定向到localhost而不是我的域。我正在使用django-allauth进行facebook身份验证。有人at 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;
}
}
有人可以澄清我在这里缺少的东西吗?
答案 0 :(得分:5)
经过大量的修修补补后,我终于找到了它。 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;
}
}