1

I have MERN stack app and both Reactjs and Nodejs are running on Same host/IP of EC2 . I have bought a domain from Godaddy so how can i point it to my domain . Am getting this error on Godaddy

Adding Record In DNS Search

Also how can i add SSL certificate for both (Frontend and NodejsServer / both running on same instance with different ports e.g 3002:react , 4000:nodejs)

  • Not too sure about the GoDaddy zone error, but for an SSL certificate you'll have to do that yourself if you're hosting the website yourself on an EC2 instance. Check out free providers of certificates, such as: https://letsencrypt.org/ – Jayce444 Dec 15 '22 at 10:20

2 Answers2

0

It can be achieved using Route53, providing high level overview here and pointing to the AWS Documentation

  1. Set static IP of your EC2 instance (Elastic IP)
  2. Configure hosted zones in Route53
  3. Create records in Godaddy

Full documentation here https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/routing-to-ec2-instance.html

It depend how you want to setup SSL for FrontEnd and Backend

Ideally for FrontEnd you point your domain to the right port of FE 3002 so that when you open your site www.mysite.com then it opens your FE

For BE, you can use your static IP or the AWS provided host name and to setup SSL follow this SO post

Avinash
  • 4,115
  • 2
  • 22
  • 41
  • i have followed your steps but still my domainname is not reachable as something is wrong but am not sure whats wrong as i have updated nameservers from my hosted zon to godaddy DNS – murtaza shah Dec 17 '22 at 06:58
  • It takes some time to be effective, if yo have done all the steps then it should work properly. – Avinash Jan 20 '23 at 11:55
0

Frontend (domain.com and www.domain.com)

Use AWS apmilify to host your static files, it will give you dns record that you can add on godaddy.

Backend (server.domain.com)

Put a loadbalancer Infront of your ec2 instance that will handle ssl and it will give you a dns record that you can add on godaddy. Loadbalancer should listen on 80 and 443 ports and can forward to 4000 on ec2 instance.

please note this is just a quick recommendation just for your use case, there are many better ways to deploy MERN apps.

ehmad11
  • 1,395
  • 3
  • 14
  • 29