Adding a domain to a django webapp running on digital ocean - django

I have a Django Web App that is currently live on digital ocean with an IP address say w.x.y.z, I have also bought a domain name say example.com, how can i add this to my app so that, when i go to example.com , I get to my website which currently is only accessible through the IP. Any advice is appreciated. I'm new to this

Buy/Register your Domain Name with Domain Name providers.
You need to mention your IP in your DNS Management side at Domain Name service providers.
At Django Side - you just make sure to add your Domain Name into settings.py file, in ALLOWED_HOSTS
And you are done!

Related

attach domain name with lightsail instense and django

I have created static ip in lightsail and attached it to the django instanse. I bought domain name from godaddy. I then created domain zone in lightsail and created 2 DNS records type "A" with the following:
#.drmahahabib.com
www.drmahahabib.com
Then i copied the name servers from the same page for my lightsail then took that to godaddy site and changed the name servers there.
Now i get the page that confirms that the lightsail is working but not the site instense of django. do i need to do some modification?
below is the screenshot or just visit the webpage.
my site
If you are using the Django internal dev server use
www.drmahahabib.com:8000
Here 8000 is the port on which you ran the Django server. If you are using another port replace 8000 with your port number
If you want to make your site live on www.drmahahabib.com then you have to configure Apache to serve your application.

Redirect a AWS static IP to domain

I have deployed a django based website on my AWS lightsail instance. the web address has a port 8000 (:8000). I own a domain on (host =fatcow.com). I have created a hosted zone on AWS and pasted the ns values to my provider(factor)'s Nameservers values. In the amazon route53, I have created a new record with a simple redirect A ipv4 and entered the resolver IP address value - my web address with port value. it doesn't work.
Also, I have read that the redirect will not work for its with port numbers. I have tried redirecting my domain to the static ip, then created another hosted zone record trying to redirect the static ip to the ip+port value - error pops up saying it is not a valid address.
I currently use the development server provided by django as it is a personal website and currently it will not have a lot of traffic - portfolio website.
Also, on my fatcow.com domain settings, the Nameservers are updated and in the whois values, new Nameservers are seen. I have only added the 4 NS values. AWS also created SOA ip values but I was not able to add them to the domain (Inputs were not taken by fatcow ).
In the NSLookup website, I can see NS values and SOA values which are on the AWS hosted zone but A records show none.
Edit: sorry for the confusion. my domain is www.chandradhar.com. I'm not a web dev but I'm trying to deploy a django based portfolio website. I have added Amazon Lightsail DNS nameservers to my domain (host=fatcow.com). the web address is :8000 port. Without the port number, the website isn't loading at all. Only with the port number along the static IP, the website loads. 'A' record isn't taking the port number. I did add a SRV record with the port number(in AWS route 53) but still doesn't work. when checked from the website nslookup.io, the nameservers are updated correctly
Not reproduceable.
> host fatcow.com
fatcow.com has address 65.254.254.33
fatcow.com mail is handled by 10 mail.fatcow.com.
Most probably your changes in DNS have already propagated.
Steps to successfully deploy one or more websites on lightsail AWS when the domain is on another website like godaddy/fatcow.
Create a dns zone in the networking section of the lightsail instance.
Copy the name servers from the dns zone and paste it in the name servers section of the domain provider (fatcow/godaddy) - it might take upto a day for the values to get updated - i used nslookup.io to see if my nameservers were updated.
Create 'A' records and SRV records pointing to the static ip of the lightsail instance.
Install Nginx
Create a simple script with the (name of the website).conf in the conf.d folder/available sites folder
Add the following script:
server
{
listen 80;
server_name domainname.com;
location / { proxy_pass http://ipAdd:PortNum;
}
}
Repeat the same code block with different domains and redirect ports. I guess we can also use 301 redirect to achieve the same.
This might or might not be the proper way of achieving what I required but it'll work.

AWS http:// and http://www going to different web sites -how can I correct this?

I'm using Amazon Web Services, and have a windows server running IIS.
Within IIS I have the default website, and another website:
I have an Elastic Load Balancer setup in Route 53 my DNS records point to the load balancer:
If I browse to http://mydomain.co.uk - it goes to the correct website in IIS.
If I browse to http://www.mydomain.co.uk - it goes to the Default website in IIS.
Is there any way I can point both www and non-www to the same website in IIS? Are my DNS records setup incorrectly?
Thanks for any help,
Mark
If both DNS records are resolving to the correct ip address of your server, then all you should need to do is setup multiple bindings on the correct website - one for www and one for the naked domain.
MY guess is that there is no IIS binding for the www, so it is resolving to the 'Default' site instead - you fix this in IIS console, not AWS console.

add godaddy domain to AWS Elastic Beanstalk site?

I have a working web app hosted on Elastic Beanstalk and have purchased a domain name on godaddy.
I've got it set up so when you visit the domain it takes you to the correct page but the URL changes to the ugly elastic beanstalk address.
At the moment when I visit the domain name URL, the URL changes to
uglyurl.5345435trgfdg.elasticbeanstalk.com/CORRECT/ROUTES
I want it like
mydomain.com/CORRECT/ROUTES
You need to configure whatever software you are running on Elastic Beanstalk (Apache or Nginx probably) to be aware of the domain name. The server software is simply redirecting all requests to the only domain it knows it is hosting.

How to redirect Domain on Amazon AWS to an external link

We have all of our domains and setup on Amazon AWS. We have created a not so complex kinda static website which is hosted on a Linux machine at a hosting company. Now we have to redirect the domain e.g. example.com and www.example.com to that url which is like temp.example.hostingcompany.com.
How can I redirect example.com and www.example.com to that url so that the user sees our url and the contents on that url are displayed.
Note: I want to make it work for both http and https. We are using Amazon https certificates.
I know we can host static websites using S3 Buckets on Amazon but its already been hosted somewhere else and I can't change that decision now.
Thanks.
If you want to migrate the website to the new domain, than its simply setup the codebase on new server and make appropriate domain changes it will work.
Secondly, If you want to just show the website on the new domain, but internally its still being available on old domain, than you can use any reverse proxy server like nginx, and use the old domain as the backend and your new domain as its front end.