问题
I hosted a nodejs(express hello world app) application on AWS Linux(Ubuntu 16.04) on free-tier. When i do wget http://localhost:8080
it runs successfully and saved the output in index.html file.
But when i do the same thing with the public ip (wget http://35.154.40.189:8080
) of my instance, it says
Connecting to 35.154.40.189:8080... failed: No route to host.
I also used the steps given in http://www.lauradhamilton.com/how-to-set-up-a-nodejs-web-server-on-amazon-ec2 to forward all ipv4 traffic to my application but it doesn't work.
I also enabled port 8080 from aws console.
netstat -atn says
netstate -ntlp says
I tried everything which i get on internet but unable to resolve the issue. Now i'm too much frustrated. Any help would be highly appreciable.
回答1:
- MAke Your Instance in AWS first
Enable inbound rule as u mention in picutre
Enable user group after ssh connection with AWS ubuntu instance
- once instance start running then Install node properly
sudu apt-get update
sudo apt-get install libssl-dev g++ make
- download source code of node from web
node.tar.gz
wih commandwget link
https://nodejs.org/dist/v6.9.1/node-v6.9.1.tar.gz tar -xvf node -v0.10.32.tar.gz
- now goto node after unzip .gz
./configure && make && sudo make && sudo make install
boom your node server is ready on new AWS instances
or watch this https://www.youtube.com/watch?v=WxhFq64FQzA&t=1693s
来源:https://stackoverflow.com/questions/40926433/aws-linux-ubuntu-hosted-application-is-not-accessible-from-public-ip