Django Allauth 修改邮件 url 从 127.0.0.0 到服务器域名

Django Allauth modify emails url from 127.0.0.0 to server domain name

Django Allauth 修改邮件 url 从 127.0.0.0 到服务器域名

Ubuntu 服务器上有 Nginx 运行。 Django contrib 站点有域。

Django allauth 发送的邮件是:

Account activate
    http://127.0.0.1:8080/accounts/confirm-email/Ng:1dJZDR:VG7ds1v0HnQKHKzdgXLHRqfL1w4/

Password reset
   http://127.0.0.1:8080/accounts/password/reset/key/3-4ms-081fe4fdd341442cd244/

当然,我想使用域 example.com 而不是 127.0.0.1:8080

可以在以下位置找到与域相关的任何信息 http://django-allauth.readthedocs.io/en/latest/configuration.html

问题出在 Nginx 上,添加以下 header 解决了问题。

添加proxy_set_header主机$http_host;在选项 proxy_pass.

之前进入你的 nginx 配置