Nginx上的Django应用程序-将其他服务器的链接重定向到我的域,我该怎么解决这个问题?

sauutmhj  于 2023-04-29  发布在  Nginx
关注(0)|答案(1)|浏览(102)

所以当我注册我的certbot文件时,我搞砸了,只注册了www.example.com,而不是加上 www.example.com 到我的网站,所以我强迫所有的proxy_pass到www.example.com能够部署除了现在当我试图链接到我的shopify商店它重定向链接回到我的www.example.com
这是我的nginx。我希望有人知道我做错了什么。..

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运行

相关问题