Django + uwsgi + nginx redirect to default page “Welcome to NGINX”

前端 未结 1 1718
礼貌的吻别
礼貌的吻别 2021-02-03 13:55

I\'m a very beginner in python and django. However I\'m trying to create a server to deploy my application. But when I want to access my app, I always get the default nginx page

1条回答
  •  有刺的猬
    2021-02-03 14:02

    The domain django.pommesky.com doesn't look like it's alive, so it's possible that Nginx is receiving requests with wrong Host: field in the HTTP request header. (sect. 14.23) So Nginx serves a default catch-all page.

    You can disable the default Nginx site by removing the /etc/nginx/sites-enabled/default link, and then restarting the daemon.

    sudo rm -v /etc/nginx/sites-enabled/default
    sudo service nginx restart
    

    You can reenable by recreating the link:

    sudo ln -sf /etc/nginx/sites-available/default /etc/nginx/sites-enabled/default
    sudo service nginx restart
    

    The other thing you can try is to setup Bind or another DNS daemon to serve a fake pommesky.com zone with all the subdomains you want and use that DNS while you're developing your site.

    Of course you can also register that domain with a hosting provider, and then use the DNS zone editor in its control panel to setup your subdomains and all the PTRs you want to whatever public IP addresses you need.

    0 讨论(0)
提交回复
热议问题