JCJC
JCJC

Reputation: 35

How can I use my godaddy domain for my Django App

This situation is some kind of hard to describe. I use nginx and uwsgi to deploy my Django blog on my VPS, it was function well, but I can only use my IP to get access to the app, how can I use my domain without www to setup my app? I set the server_name breakwire.me and set a A record HOST is '@', point to my VPS's IP, but if I visit the breakwire.me, I can only see

"Welcome to nginx"

Here is my nginx conf

# 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   
  }
}

Upvotes: 1

Views: 1640

Answers (1)

pushrbx
pushrbx

Reputation: 312

Change the

listen 106.186.29.228:8000

to

listen 106.186.29.228

or: 106.186.29.228:80

The browsers are always connecting on port 80. Your virtual server in nginx is listening on port 8000, so if you try to open your website with http://breakwire.me:8000/ it's working because you've set the port to 8000 in the listen directive.

Upvotes: 1

Related Questions