简体   繁体   中英

MEAN Stack : How to use deliver a node.js app without giving it a domain name?

I have an AngularJS app which I am serving on Nginx. That AngularJS App fetches its data from a NodeJS server which is currently running on a Ubuntu 16.04 AWS server which is the same server from which the frontend is being the served. Now I try accessing the server via localhost:8080/login and it doesn't work. This site is served on my browser, so localhost is actually my computer. I can actually create the domain name for the NodeJS server and serve it. But I am not looking at that.Is there a way I could do it without that? I am using Nginx to serve my website.

You don't need to have a domain name if you're ok with accessing your app with an IP address. Just make sure that you enter the correct IP address of your server (plus correct port if it's non-standard).

localhost is always translated to IP 127.0.0.1 which means your own computer. It works for development when you run the app locally but when it is on some server then you need to tell your browser where it is - by using a domain name or an IP address.

This is not specific to Angular or Node. This is true for any website.

If you already have some domain then you can use a subdomain for your app.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM