AWS first node.js express project

本篇重點不是在於使用express或是node.js建立web server...
而是在建立了express project之後,server也起來了...但是卻連不上線的問題...

[ec2-user@ip-10-166-202-213 ~]$ npm install express ejs mail mysql
...(Skip)

[ec2-user@ip-10-166-202-213 ~]$ express TestPrj

   create : TestPrj
   create : TestPrj/package.json
   create : TestPrj/app.js
   create : TestPrj/public
   create : TestPrj/public/javascripts
   create : TestPrj/public/images
   create : TestPrj/public/stylesheets
   create : TestPrj/public/stylesheets/style.css
   create : TestPrj/routes
   create : TestPrj/routes/index.js
   create : TestPrj/views
   create : TestPrj/views/layout.jade
   create : TestPrj/views/index.jade

   dont forget to install dependencies:
   $ cd TestPrj && npm install

[ec2-user@ip-10-166-202-213 ~]$ cd TestPrj/
[ec2-user@ip-10-166-202-213 TestPrj]$ npm install
jade@0.22.1 ./node_modules/jade 
├── commander@0.5.2
└── mkdirp@0.3.0
express@2.5.8 ./node_modules/express 
├── qs@0.4.2
├── mime@1.2.4
├── mkdirp@0.3.0
└── connect@1.8.6
[ec2-user@ip-10-166-202-213 TestPrj]$ 

[ec2-user@ip-10-166-202-213 TestPrj]$ node app.js 
Express server listening on port 3000 in development mode

這邊是我的重點...要開通m1的Security Groups設定阿....
這邊請務必加上"Custom TCP Rule",指定給0.0.0.0/0 (即是全部IP都可連線的意思)
Port的部分,預設express是開在3000 port
使用這個預設的話,就必須打開3000 port