SPA 프로젝트 배포 이해하기
serve 패키지로 React Wep App 배포하기
AWS S3 에 React Wep App 배포하기
node.js express 로 React Wep App 배포하기
NginX 로 React Wep App 배포하기
서버사이드 렌더링 이해하기
Software Engineer | Studio XID, Inc.
Microsoft MVP
TypeScript Korea User Group Organizer
Electron Korea User Group Organizer
Marktube (Youtube)
git clone https://github.com/2woongjae/tic-tac-toe.git
cd tic-tac-toe
npm ci
npm run build
npm install serve -g
serve -s build
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "PublicReadGetObject",
"Effect": "Allow",
"Principal": "*",
"Action": [
"s3:GetObject"
],
"Resource": [
"arn:aws:s3:::react-camp/*"
]
}
]
}
npm i express
const express = require('express');
const path = require('path');
const app = express();
app.use(express.static(path.join(__dirname, 'build')));
// app.get('/', function(req, res) {
app.get('*', function(req, res) {
res.sendFile(path.join(__dirname, 'build', 'index.html'));
});
app.listen(9000);
sudo apt-get update
sudo apt-get upgrade
wget http://nginx.org/keys/nginx_signing.key
sudo apt-key add nginx_signing.key
sudo rm -rf nginx_signing.key
sudo nano /etc/apt/sources.list
```
deb http://nginx.org/packages/mainline/ubuntu/ trusty nginx
deb-src http://nginx.org/packages/mainline/ubuntu/ trusty nginx
```
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install nginx
nginx -v
server {
listen 80;
server_name localhost;
root /home/ubuntu/tic-tac-toe/build;
index index.html;
location / {
try_files $uri $uri/ /index.html;
}
}