Linode에 Angular 4를 배치하는 데 문제가 있습니다.Linode에 각도 배치
Angular-cli를 사용하여 기본 Google지도를 렌더링하는 작은 Angular 4 앱이 있습니다. here을 찾을 수 있으며 Mac에서 로컬로 잘 실행됩니다.
Linode는 Fedora 25를 잘 실행하도록 설정되어 있으며, ssh를 사용할 수 있습니다.
호스트 이름 'ofeyspi'를 설정하고 저장소를 복제했습니다. 호스트 이름을 확인
$ hostname
ofeyspi
는
$ cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
139.162.199.9 ofeyspi.qqiresources.com ofeyspi
가 그럼 난 실행 URL로 연결되어있다 :이 오류가 제공하는 템플릿 요소에 문제가 볼 수 있듯이
$ ng build --prod --bh /root/beans3/dist/
11% building modules 9/9 modules 0 activeTemplate parse warnings:
The <template> element is deprecated. Use <ng-template> instead ("
<div class="card">
[WARNING ->]<template ngFor let-panel [ngForOf]="panels">
<div role="tab" id="{{panel.id}}-header" [attr.ar"): ng:///root/beans3/node_modules/@ng-bootstrap/ng-bootstrap/accordion/[email protected]:4
Hash: 079970cfbabe6b2f710a
Time: 34065ms
chunk {0} polyfills.a3e056f914d9748ff431.bundle.js (polyfills) 158 kB {4} [initial] [rendered]
chunk {1} main.47083d1d3073f3856af7.bundle.js (main) 142 kB {3} [initial] [rendered]
chunk {2} styles.604a57bc7d4c0f84e447.bundle.css (styles) 122 bytes {4} [initial] [rendered]
chunk {3} vendor.244ceb2ee1e4bb317079.bundle.js (vendor) 1.39 MB [initial] [rendered]
chunk {4} inline.df954263324e7c133385.bundle.js (inline) 0 bytes [entry] [rendered]
, 이것은 개발 단계에서 무시할 수 있지만 제작 과정에서 동일하다는 것은 놀라운 일입니다.
이 새로운 DIST 디렉토리를 만든 다음 내가 실행
$ ng server --host qqiresources.com
와 나는 또한 시도했다가,
$ ng server --host 139.162.199.9
** NG Live Development Server is running on http://139.162.199.9:4200 **
Hash: 2391cafc7c903540029f
Time: 17824ms
chunk {0} polyfills.bundle.js, polyfills.bundle.js.map (polyfills) 158 kB {4} [initial] [rendered]
chunk {1} main.bundle.js, main.bundle.js.map (main) 10.5 kB {3} [initial] [rendered]
chunk {2} styles.bundle.js, styles.bundle.js.map (styles) 150 kB {4} [initial] [rendered]
chunk {3} vendor.bundle.js, vendor.bundle.js.map (vendor) 2.67 MB [initial] [rendered]
chunk {4} inline.bundle.js, inline.bundle.js.map (inline) 0 bytes [entry] [rendered]
webpack: Compiled successfully.
내가 http://qqiresources.com:4200 또는 http://139.162.199.9:4200로 이동
나는 연결 오류가 발생합니다. 내가 dist 디렉토리 내부 및 프로젝트의 루트 디렉토리에 두 번째 명령을 실행하려고했습니다Failed to load resource: net::ERR_CONNECTION_REFUSED
콘솔 쇼를, "이 사이트에 연결할 수 없습니다."
제가 누락 된 다른 것이 있습니까?
는 UPDATE : 여전히 http://139.162.199.9:8080로 이동이 나타납니다
$ http-server
Starting up http-server, serving ./
Available on:
http://127.0.0.1:8080
http://139.162.199.9:8080
Hit CTRL-C to stop the server
그러나, 는 그 NG 서버가 정확하지 지금보고, 그래서 노드를 설치하고 내가 HTTP 서버 실행 dist 디렉토리로 이동 동일한 '사이트에 연결할 수 없음'메시지가 표시됩니다.
감사
UPDATE : 나는 아파치 2 작업을했고, dist 디렉토리에있는 index.html 파일을 제공했다. 그러나 dist에있는 다른 파일을 사용하는 데 문제가있는 것 같습니다. 나는 그것에 질문을 게시했다 Running Angular-cli on Apache 2
나는 linode에 대해 많이 모른다. 그러나 프로덕션 환경에서 결코 '봉사'를하지 말아야합니다. 아파치, nginx 또는 프로덕션 노드 서버를 통해 정적으로 'dist'폴더를 제공하지 않는 이유는 무엇입니까? –
그래, 프로덕션에서 서브를 사용해서는 안됩니다. 노드 서버가 필요합니다. 고마워요. 저를 다른 트랙으로 보내주세요. –
질문에 대한 답변을 추가했습니다. iether가 응답을 수락하거나 대답을 추가 한 다음 수락 할 수 있습니다. 고맙습니다. –