通过域重定向到IP连接到网站(没有指南或“修复”帮助)

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

我正在使用GoDaddy域并将其连接到DigitalOcean上托管的django + gunicorn + nginx droplet。在尝试了DO,nginx等的配置之后,我仍然得到相同的结果。当我尝试通过域连接时,它将其更改为IP地址并继续...我停在上一个nginx配置是:

server {
listen 80;
server_name example.com www.example.com ip.ip.ip.ip;

location = /favicon.ico { access_log off; log_not_found off; }
location /static/ {
    root /home/user/webapp;
}

location /media/ {
    root /home/user/webapp;
}

location / {
    include proxy_params;
    proxy_pass http://unix:/home/user/webapp/webapp.sock;
}
}

从nginx conf中完全删除IP导致相同的行为,但是我没有获得Django网页,而是被重定向到nginx默认网页,域又被更改为IP。

django nginx dns ip digital-ocean
1个回答
1
投票

尝试使用此声明

location \homepage { rewrite ^ http://$host$request_uri? permanent; }

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