AWS는 Amazon Web Service의 줄임말 입니다. AWS는 소위 클라우드 서비스라고도 합니다. 클라우드 서비스는 서버 등의 인프라스트럭쳐를 필요한대로 on demand로 사용할 수 있는 서비스 입니다. 즉, 유저가 직접 서버를 구입하고 설치할 필요 없이 AWS상에서 클릭 몇번으로 서버를 구축하고 사용할 수 있습니다.
t2.nano
(CPU 1, 0.5 GB memory) 부터 x1.32xlarge
(CPI 128, 1952 GB) 까지 다양하게 제공함으로 필요한 사양의 EC2 인스턴스(instnace)를 선택해서 사용하면 된다 (물론 사양이 좋을 수록 비싸다).ssh -i key이름.pem ubuntu@나의 서버 ip주소
curl -sL https://deb.nodesource.com/setup_10.x | sudo bash -
sudo apt-get update
sudo apt-get install nodejs
git clone 주소
cd 프로젝트 파일명
npm install
vi setver.js
const http = require("http");
const express = require("express");
const path = require("path");
const app = express();
const port = 8000;
app.get("/ping", (req, res) => {
res.send("pong");
});
app.use(express.static(path.join(__dirname, "build")));
app.get("/*", (req, res) => {
res.set({
"Cache-Control": "no-cache, no-store, must-revalidate",
Pragma: "no-cache",
Date: Date.now()
});
res.sendFile(path.join(__dirname, "build", "index.html"));
});
http.createServer(app).listen(port, () => {
console.log(`app listening at ${port}`);
});
npm istall express --save
npm run build
node server.js