{"id":1327,"date":"2017-05-12T12:12:33","date_gmt":"2017-05-12T03:12:33","guid":{"rendered":"https:\/\/www.rocher.kyoto.jp\/arbr\/?p=1327"},"modified":"2017-05-12T12:41:41","modified_gmt":"2017-05-12T03:41:41","slug":"ng-serve%e3%81%ae%e8%b5%b7%e5%8b%95%e3%82%aa%e3%83%97%e3%82%b7%e3%83%a7%e3%83%b3","status":"publish","type":"post","link":"https:\/\/www.rocher.kyoto.jp\/arbr\/?p=1327","title":{"rendered":"ng serve\u306e\u8d77\u52d5\u30aa\u30d7\u30b7\u30e7\u30f3"},"content":{"rendered":"<p>Angular\u3092\u5c11\u3057\u89e6\u3063\u3066\u304a\u304f\u304b\u3068\u601d\u3044\u958b\u767a\u6a5f(CentOS)\u306eVagrant\u4e0a\u306b\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3002<br \/>\npublic network\u7d4c\u7531\u3067\u4f5c\u696d\u7aef\u672b\uff08\u975e\u529b\u306aWindows\uff09\u304b\u3089\u3064\u306a\u3054\u3046\u3068\u601d\u3063\u3066\u3082\u63a5\u7d9a\u3092\u62d2\u5426\u3055\u308c\u305f\u3002<\/p>\n<pre>\u3053\u306e\u30b5\u30a4\u30c8\u306b\u30a2\u30af\u30bb\u30b9\u3067\u304d\u307e\u305b\u3093\r\n\r\n192.168.1.108 \u3067\u63a5\u7d9a\u304c\u62d2\u5426\u3055\u308c\u307e\u3057\u305f\u3002\r\n192 168 108 4200 \u3092 Google \u3067\u691c\u7d22\u3057\u3066\u304f\u3060\u3055\u3044\r\nERR_CONNECTION_REFUSED<\/pre>\n<p>ping\u306f\u901a\u308b\u3051\u3069\u3001\u958b\u767a\u6a5f\uff08Vagrant\u306e\u30db\u30b9\u30c8\uff09\u304b\u3089\u3082curl\u3067\u3064\u306a\u304c\u3089\u306a\u3044\u3002vagrant\u306b\u5165\u3063\u3066\u30c1\u30a7\u30c3\u30af\u3059\u308b\u3068localhost\u306a\u3089\u7e4b\u304c\u308b\u3002<\/p>\n<pre>curl http:\/\/<span style=\"color: #ff0000;\">192.168.1.108<\/span>:4200\r\ncurl: (7) Failed connect to 192.168.1.108:4200; \u63a5\u7d9a\u3092\u62d2\u5426\u3055\u308c\u307e\u3057\u305f\r\n\r\n[root@localhost log]# curl http:\/\/<span style=\"color: #ff0000;\">localhost<\/span>:4200\r\n&lt;!doctype html&gt;\r\n&lt;html&gt;\r\n&lt;head&gt;\r\n &lt;meta charset=\"utf-8\"&gt;\r\n &lt;title&gt;TestWeb&lt;\/title&gt;\r\n &lt;base href=\"\/\"&gt;\r\n\r\n &lt;meta name=\"viewport\" content=\"width=device-width, initial-scale=1\"&gt;\r\n &lt;link rel=\"icon\" type=\"image\/x-icon\" href=\"favicon.ico\"&gt;\r\n&lt;\/head&gt;\r\n&lt;body&gt;\r\n &lt;app-root&gt;Loading...&lt;\/app-root&gt;\r\n&lt;script type=\"text\/javascript\" src=\"inline.bundle.js\"&gt;&lt;\/script&gt;&lt;script type=\"text\/javascript\" src=\"polyfills.bundle.js\"&gt;&lt;\/script&gt;&lt;script type=\"text\/javascript\" src=\"styles.bundle.js\"&gt;&lt;\/script&gt;&lt;script type=\"text\/javascript\" src=\"vendor.bundle.js\"&gt;&lt;\/script&gt;&lt;script type=\"text\/javascript\" src=\"main.bundle.js\"&gt;&lt;\/script&gt;&lt;\/body&gt;\r\n&lt;\/html&gt;<\/pre>\n<p><a href=\"https:\/\/github.com\/angular\/angular-cli\/issues\/2375\">\u3050\u3050\u308b<\/a>\u3068host\u30aa\u30d7\u30b7\u30e7\u30f3\u4ed8\u3051\u306a\u3044\u3068\u3001localhost\u3057\u304blisten\u3057\u306a\u3044\u3089\u3057\u3044<\/p>\n<pre>[root@localhost log]# netstat -anp\r\nActive Internet connections (servers and established)\r\nProto Recv-Q Send-Q Local Address           Foreign Address         State       PID\/Program name\r\ntcp        0      0 0.0.0.0:111             0.0.0.0:*               LISTEN      1\/systemd\r\ntcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      1201\/sshd\r\ntcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN      1719\/master\r\ntcp        0      0 <span style=\"color: #ff0000;\">127.0.0.1:4200<\/span>          0.0.0.0:*               LISTEN      3792\/@angular\/cli<\/pre>\n<p>ng serve<span style=\"color: #ff0000;\"> &#8211;host<\/span> 192.168.1.108<br \/>\n\u3068\u3057\u3066\u304a\u3044\u3066\u78ba\u8a8d<\/p>\n<pre>[root@localhost log]# netstat -anp\r\nActive Internet connections (servers and established)\r\nProto Recv-Q Send-Q Local Address           Foreign Address         State       PID\/Program name\r\ntcp        0      0 0.0.0.0:111             0.0.0.0:*               LISTEN      1\/systemd\r\ntcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      1201\/sshd\r\ntcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN      1719\/master\r\ntcp        0      0 <span style=\"color: #ff0000;\">192.168.1.108:4200<\/span>      0.0.0.0:*               LISTEN      3827\/@angular\/cli<\/pre>\n<p>Local Address\u306b\u8a2d\u5b9a\u3055\u308c\u308b\u3002<\/p>\n<p>\u8abf\u3079\u308b\u904e\u7a0b\u3067SELinux\u3068Firewall\u3068\u3081\u305f\u3002<\/p>\n<p>SELinux\u306f\u8d77\u52d5\u3060\u3051\u3060\u3068audit.log\u306b\u4f55\u3082\u3067\u3066\u3044\u306a\u3044\u3002\u52d5\u4f5c\u78ba\u8a8d\u3067\u30cf\u30de\u308a\u305f\u304f\u306a\u3044\u306e\u3067permissive\u306e\u307e\u307e\u6642\u3005audit\u307f\u3066\u78ba\u8a8d\u3050\u3089\u3044\u306b\u3057\u3066\u304a\u304f\u3002<\/p>\n<p>Firewall\u306fport\u304c\u7a7a\u3044\u3066\u3044\u306a\u3044\u306e\u3067\u7a7a\u3051\u3066\u304a\u304f\u3002\uff08\u8272\u3005\u3042\u3051\u308b\u5fc5\u8981\u304c\u3067\u3066\u9762\u5012\u306b\u306a\u3063\u305f\u3089Firewall\u3068\u3081\u305f\u307e\u307e\u52c9\u5f37\u3059\u308b\uff09<\/p>\n<pre>[vagrant@localhost ~]$ sudo firewall-cmd --list-ports --zone=public\r\n\uff08\u7a7a\u6b04\uff09\r\n[vagrant@localhost ~]$ sudo firewall-cmd --add-port=4200\/tcp --zone=public --permanent\r\nsuccess\r\n[vagrant@localhost ~]$ sudo firewall-cmd --reload\r\nsuccess\r\n[vagrant@localhost ~]$ sudo firewall-cmd --list-ports --zone=public\r\n4200\/tcp<\/pre>\n<p>host\u30aa\u30d7\u30b7\u30e7\u30f3\u306e\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u306f\u3071\u3063\u3068\u307f\u898b\u3064\u304b\u3089\u306a\u304b\u3063\u305f\u3051\u3069\u3001\u3044\u3064\u3082\u306eGoogle\u3055\u3093\u3067\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u306f\u7121\u3044\u3082\u306e\u3068\u8003\u3048\u305f\u3089\u3044\u3044\u306e\u304b\u306a\uff1f\uff1f<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Angular\u3092\u5c11\u3057\u89e6\u3063\u3066\u304a\u304f\u304b\u3068\u601d\u3044\u958b\u767a\u6a5f(CentOS)\u306eVagrant\u4e0a\u306b\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3002 public network\u7d4c\u7531\u3067\u4f5c\u696d\u7aef\u672b\uff08\u975e\u529b\u306aWindows\uff09\u304b\u3089\u3064\u306a\u3054\u3046\u3068\u601d\u3063\u3066\u3082\u63a5\u7d9a\u3092\u62d2\u5426\u3055\u308c\u305f\u3002 \u3053\u306e\u30b5\u30a4\u30c8\u306b\u30a2\u30af [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[31],"tags":[97],"class_list":["post-1327","post","type-post","status-publish","format-standard","hentry","category-oss","tag-angular"],"_links":{"self":[{"href":"https:\/\/www.rocher.kyoto.jp\/arbr\/index.php?rest_route=\/wp\/v2\/posts\/1327","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.rocher.kyoto.jp\/arbr\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rocher.kyoto.jp\/arbr\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rocher.kyoto.jp\/arbr\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rocher.kyoto.jp\/arbr\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1327"}],"version-history":[{"count":4,"href":"https:\/\/www.rocher.kyoto.jp\/arbr\/index.php?rest_route=\/wp\/v2\/posts\/1327\/revisions"}],"predecessor-version":[{"id":1331,"href":"https:\/\/www.rocher.kyoto.jp\/arbr\/index.php?rest_route=\/wp\/v2\/posts\/1327\/revisions\/1331"}],"wp:attachment":[{"href":"https:\/\/www.rocher.kyoto.jp\/arbr\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1327"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rocher.kyoto.jp\/arbr\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1327"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rocher.kyoto.jp\/arbr\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1327"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}