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
Related
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.
I followed this tutorial to deploy NodeJS my app on the server.
My issue is that, I only can access the service using domain:port (example.com:1234) not domain name only (example.com).
How can I configure my app to access the service without adding the port to the address/domain name?
TCP connections always require you, the client, to specify a port. You're able to visit domain.com in your browser without specifying a port because your browser implicitly connects on the conventional ports: 80 for HTTP and 443 for HTTPS.
Your application server needs to bind to one of these ports in order to achieve what you're going for.
EDIT: Just skimmed the tutorial you linked to. Since your application is sitting behind a reverse proxy , you'll need NGINX to own 80/ 443 (which it should do by default). You can bind the app server to whatever port you want, so long as the reverse proxy config matches up with it.
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.
I have a server that runs different websites on different ports. All of them (but one) are Apache servers and thanks to webmin, I managed to have, for instance, example.com point to 123.123.123.123:80 and example.fr to 123.123.123.123:8000, somehow automatically
I am now running a nodejs server on the same machine, so the 80, 8000, and many other ports are already taken. My nodejs listens on 8008. I have another domain name, say example.org, and I want it to point to my nodejs website, but I simply don't know how to do that! I have updated the DNS and everything is pointing to 123.123.123.123 (my server's IP). I want to avoid using an ugly example.org:8008/ for everything on this node server. How can I make it point implicitly to the 8008 port?? I must add that I cannot afford to take down the apache servers ;)
DNS only provides name to ip address mapping. It cannot handle ports. What you can do instead is to set up a proxy server listening on port 80. The proxy server can then return data based on the host header.
Your best option is to just redirect the request from Apache. Otherwise you can use a reverse proxy like Nginx. Also, you can write a lightweight proxy in node... check out this page
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.