man*_*anu 2 nginx facebook-oauth django-allauth
通过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;
}
}
Run Code Online (Sandbox Code Playgroud)
有人可以澄清我在这里缺少的东西吗?
经过大量的修修补补后,我终于找到了它.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;
}
}
Run Code Online (Sandbox Code Playgroud)