Namecheap domain name for DigitalOcean - node.js

Beginner question here. I tried plenty of tutorials but I cannot seem to get the domain name up.
Basically, I deployed my node app on DigitalOcean and the link works (I use the port 5000 jic). These are the steps I took from there:
Set up a domain on DigitalOcean.
Copied the 3 DNS links (ns3.digitalocean.com) to namecheap on custom DNS.
Create a new record on DigitalOcean with the IP of my project (without port as thats not accepted).
I can now access the website using the domain name but I need to put the port number as well, ie. mylink.com:5000
How do I avoid that or can someone explain me the right steps to link my namecheap domain with my digitalocean node app? This is my first time doing this.

Basically you cannot, you should either use port 80 for HTTP, or port 443 for HTTPS so the URL won't need a port (it defaults to them automatically) or you will have to use reverse-proxy (e.g. nginx) if you have to keep your port 5000.

Related

point node js app to domain

I want to point a domain to the nodejs app running on 3000 port.
Currently my app is hosted on aws. If I have to point my domain to the app, so that I don't have to write <domain>:<port_number> in browser then I think I have two options:
use nginx to proxy the request to port 3000
use aws route 53 for the same
Correct me if I'm wrong and please suggest which one should I opt
Route 53 is just a Domain Name Server.
If you fire up a EC2 instance, you can reach it with the IP address. In addition you get a generic domain to connect to your EC2 instance, something like this: ec2-xx-xxx-xxx-xxx.eu-west-1.compute.amazonaws.com
This is ok for testing, but not for a production setup.
So if you want to point a more pleasant domain name to your instance, you need to edit the dns record on your DNS Server. For this you can use Route 53 or any other DNS Service like namecheap or iwantmyname.com.
You can't configure ports there, so use option 1 and set up nginx.
Of cause, as option 3 you can change the port of your nodejs app to port 80, but then you need to run it as root user and that is really bad practice!
So stick with nginx.
More about DNS: https://en.wikipedia.org/wiki/Domain_Name_System

Serving Node.JS app on a existing server running page on port 80

I have a server at www.example.com running a PHP-made webpage served by Apache, this page is listening to port 80.
Now I want to serve my Node.JS on the domain www.example2.com. Both pages should be on the same server, the Node.JS app should be running on port 3000. How do I achieve this?
From other answers and blog posts (like this one: http://garr.me/blog/running-node-js-and-apache-together-using-mod_proxy/) I have learnt that I can create a ReverseProxy to redirect www.example.com/app to my app, however this is not the intended behavior. What I want is this new domain www.example2.com to go the server's ip address at port 3000.
Side question: This question might sound stupid but, can't I redirect the whole domain to the server's IP address at port 3000 from the domain name configuration at GoDaddy/Route53???
Thanks.
Yes to your side question. i think thats the best approach. Have your domain configuation on go daddy go to the ip address and 3000 port.

My cloudflare settings are all configured but not working

So, I am using CloudFlare at the moment for my DNS records. I have my team speak server A-Record at ts.servername.net and pointing to my ip 100.100.100.100, and all my other A-Records are pointing to exactly where they should be and activated.
They were working previously but all of a sudden for the last week or so, we have had to use our IPv4 ts server ip in order to connect instead of our server name, why is it doing this even though everything is setup and was already working?
I would recommend opening a support ticket with specific details & we can help.
Please note that we can only proxy web traffic records going over certain ports like 80 and 443.

AWS redirect URL with AngularJS running in Node.js server

I´m trying to config a website hosted in AWS EC2 instance. But Im a bit mixed!!
I have an AngularJS application running in a Node.js server listening on port 1234. This site is deployed correctly, so when I get the url in a browser ec2-instance-public-dns:1234/app/index.html I see my site perfectly.
In the other hand, I registered a domain name in GoDaddy. I set up a Route 53 and the DNS names in GoDaddy.
I see, I also have a load balancer listening in port 80, that is redirecting to port 1234.
What I need is to link my domain with my site in the path ec2-instance-public-dns:1234/app/index.html
All this stuff is not working. How can I achieve this?
Is there is reason why you don't have Node listen to 80 or 8080 ?
Does the DNS redirection work ? -> Can you access your site with www.yourdomainname.com:1234 ?
-> If no, then check your dns config, you should not have to deal with port routing at that level.
Are you using Linux as your EC2 instance ? If yes, reroute port 80 toward port 1234 as explained here (http://www.cyberciti.biz/faq/linux-port-redirection-with-iptables/).
That how I do it, hope that helps.

How do IP addresses work on a VPS? Routing a domain name to Node.JS

This is an absolute newb question. But I'm buying my first VPS for the reason that I want to install and start creating applications in Node.JS.
I can't visualise in my mind how the server works and where all of the applications such as Apache, Node.JS and PHP sit. I'm so used to a GUI.
I want www.mydomain.com to point to node.JS on my server, let's say Node is listening to port 8080. Now I know that HTTP defaults to port 80 of the IP address, so I can't use that. How do I set the domain up to resolve at www.mydomain.com:8080 - I read this wasn't possible...
My brain is melting.
Thanks :)
You just point the domain to your ip address as you normally do. The issue you will have it that HTTP default to port 80, so either you manually add the port at the end of the host to get to the page or you setup Apache to proxy specific urls to 8080, which gets some of your Node stuff appearing to work under 80.
If you aren't using Apache for anything you can also have your Node app bind to port 80. You will probably need to setup authbind or something to give your node app permission to bind to port < 1024.

Resources