Nginx 上的 DJango 应用程序 - 将指向其他服务器的链接重定向回我的域。我该如何解决?

问题描述 投票:0回答:1

所以我在注册我的 certbot 文件时搞砸了,只为 www.example.com 注册了它,而不是在我的网站上加上 domain.com,所以我强制所有 proxy_pass 到 www.example.com 才能部署除了现在当我尝试链接到我的 shopify 商店时它会将链接重定向回我的www.example.com

这是我的 nginx.conf,希望有人知道我做错了什么......

user www-data;
worker_processes auto;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;

events {
        worker_connections 4096;
        # multi_accept on;
}


http {
        sendfile on;
        tcp_nopush on;
        types_hash_max_size 2048;
        include /etc/nginx/mime.types;
        default_type application/octet-stream;
        ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3;
        ssl_prefer_server_ciphers on;
        access_log /var/log/nginx/access.log;
        error_log /var/log/nginx/error.log;
        gzip on;

    server {
            listen 80;
            return 444;
    }
    server {
            server_name www.example.com, example.com;
            listen 80;
            return 307 https://www.example.com$request_uri;
    }
    server {
        listen [::]:443 ssl ipv6only=on; # managed by Certbot
        listen 443 ssl; # managed by Certbot
        server_name www.example.com;
        ssl_certificate /etc/letsencrypt/live/www.example.com/fullchain.pem; # managed by Certbot
       ssl_certificate_key /etc/letsencrypt/live/www.example.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

            location / {
                # First attempt to serve request as file, then
                # as directory, then fall back to displaying a 404.;
                  proxy_pass http://unix:/run/gunicorn.sock;                            
                  proxy_set_header        Host $host;
                  proxy_set_header X-Forwarded-Proto $scheme;
                  proxy_set_header X-Forwarded_For $proxy_add_x_forwarded_for;
                  proxy_redirect off;
            }
            location /static/ {
                    autoindex on;
                    alias /var/www/www.example.com/static/;
        }
    }
}

任何帮助将不胜感激。

我尝试更改正在监听什么的端口并尝试弄乱标题,删除一些以查看是否有任何效果但到目前为止没有任何效果,这是迄今为止我的 gunicorn 运行的理想设置

django nginx proxy gunicorn certbot
1个回答
0
投票

嗯,这是我的 DNS 服务器....

© www.soinside.com 2019 - 2024. All rights reserved.