简体   繁体   中英

NodeJs Application on Aws Ubuntu is running on ipv6

While running nodejs with express application on AWS ubuntu 16.04, it's running on tcp6 and due to this, i'm unable to access my application. see below screenshot. 在此处输入图片说明

after adding IP address while creating server, it's giving below error. 在此处输入图片说明

I'm new to linux, so I do not know how to resolve it. please suggest.

You need to explicitly provide an IP to bind to in Node.js, otherwise it binds to IPv6. Documented here: https://nodejs.org/dist/latest-v6.x/docs/api/http.html#http_server_listen_port_hostname_backlog_callback

Somewhere in your code you should have something similar to this:

var app = express();
app.listen(1234);

Change it to:

var app = express();
app.listen(1234, '127.0.0.1');

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