Nginx proxy_pass无法正常工作

时间:2017-12-11 13:51:32

标签: nginx google-oauth

我正使用FlaskUbuntu部署Nginx个应用程序,我还安装了 letsencrypt 服务,因此我可以使用 https 使用google oauth api,我还在我的Google控制台中的授权重定向URI 中添加了回调 uri的IP和域。

我的问题是如果我想使用google oauth登录,我会被重定向到 http://127.0.0.1:5445/login/google/authorized?state= 并收到此错误:

This site can’t be reached

我在谷歌重定向到我的网站后得到此错误,但我不知道为什么它将我重定向到此IP地址我将其重定向到我的nginx配置中的原始网站,您可以在此处看到{{ 1}}

app.conf

proxy_redirect http://127.0.0.1:5445/login/google/authorized https://www.website.com/login/google/authorized;

app.service

server {
    listen 80;
    server_name website.com www.website.com *.website.com;
    location / {
        proxy_pass http://127.0.0.1:5445/;
        proxy_redirect http://127.0.0.1:5445/login/google/authorized https://www.website.com/login/google/authorized;
        #include uwsgi_params;
        #uwsgi_pass unix:/home/userp/website.com/website.com.sock;
    }

    listen 443 ssl; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/website.com/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/website.com/privkey.pem; # managed by Certbot

    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot

    #ssl_ciphers 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM$
    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
    ssl_stapling on;
    ssl_stapling_verify on;
    add_header Strict-Transport-Security max-age=15768000;


    if ($scheme != "https") {
        return 301 https://$host$request_uri;
    } # managed by Certbot

}

0 个答案:

没有答案