如何将我的 godaddy 域用于我的 Django 应用程序

How can I use my godaddy domain for my Django App

这种情况有些难以描述。我使用 nginx 和 uwsgi 在我的 VPS 上部署我的 Django 博客,它运行良好,但我只能使用我的 IP 来访问该应用程序,我如何在没有 www 的情况下使用我的域来设置我的应用程序?我设置了server_namebreakwire.me并且设置了一个A记录HOST是'@',指向我VPS的IP,但是如果我访问breakwire.me,我只能见

"Welcome to nginx"

这是我的 nginx 配置文件

# my_blog__nginx.conf
# configuration of the server
server {
  the port your site will be served on
  listen     106.186.29.228:8000;
  # the domain name it will serve for
  server_name breakwire.me; # substitute your machine's IP address or FQDN
  charset     utf-8;

  # max upload size
  client_max_body_size 75M;   # adjust to taste

  # logs
  access_log /home/chen/DjangoProjects/my_blog/logs/access.log;
  error_log /home/chen/DjangoProjects/my_blog/logs/error.log;

  # Django media
  location /media {  
    alias /home/chen/DjangoProjects/my_blog/media; # your Django project's media files - amend as required
  }

  location /static {
    alias /home/chen/DjangoProjects/my_blog/static; # your Django project's static files - amend as required
  }

  # Finally, send all non-media requests to the Django server.
  location / {
    uwsgi_pass  106.186.29.228:8001;
    include     /home/chen/DjangoProjects/my_blog/uwsgi_params; # the uwsgi_params file you installed   
  }
}

更改

listen 106.186.29.228:8000

listen 106.186.29.228

或:106.186.29.228:80

浏览器始终连接到端口 80。您在 nginx 中的虚拟服务器正在侦听端口 8000,因此如果您尝试使用 http://breakwire.me:8000/ 打开您的网站 它可以正常工作,因为您在 listen 指令中将端口设置为 8000。