Skip to content

Instantly share code, notes, and snippets.

@rch850
Created April 16, 2014 02:33
Show Gist options
  • Select an option

  • Save rch850/10799755 to your computer and use it in GitHub Desktop.

Select an option

Save rch850/10799755 to your computer and use it in GitHub Desktop.

Elastic Beanstalk で node.js のサーバ立てたときの様子。

80 番ポートへのアクセスはできる。

$ curl -I http://localhost:80/
HTTP/1.1 200 OK
Server: nginx/1.4.3
Date: Wed, 16 Apr 2014 02:19:18 GMT
Connection: keep-alive

netstat -nlt しても 80 番ポートが開かれているようには見えない。

$ netstat -nlt
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address               Foreign Address             State
tcp        0      0 0.0.0.0:8080                0.0.0.0:*                   LISTEN
tcp        0      0 0.0.0.0:8081                0.0.0.0:*                   LISTEN
tcp        0      0 0.0.0.0:22                  0.0.0.0:*                   LISTEN
tcp        0      0 127.0.0.1:25                0.0.0.0:*                   LISTEN
tcp        0      0 :::22                       :::*                        LISTEN

iptables を見ると 80 が 8080 にリダイレクトされていることが分かる。

$ sudo service iptables status
Table: nat
Chain PREROUTING (policy ACCEPT)
num  target     prot opt source               destination
1    REDIRECT   tcp  --  0.0.0.0/0            0.0.0.0/0            tcp dpt:80 redir ports 8080

Chain INPUT (policy ACCEPT)
num  target     prot opt source               destination

Chain OUTPUT (policy ACCEPT)
num  target     prot opt source               destination
1    REDIRECT   tcp  --  0.0.0.0/0            0.0.0.0/0            tcp dpt:80 redir ports 8080

Chain POSTROUTING (policy ACCEPT)
num  target     prot opt source               destination
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment