ec2 우분투내에서 git pull을 받은 후 npm run build 와 npm run start를 하면 서버가 생성된다.
기본값은 http://127.0.0.1:3000 이며 도메인이 없을시 탄력적 ip로 바로 배포된 사이트를 볼 수 있다.
server_name domain.com;
location / {
proxy_set_header HOST $host;
proxy_pass http://127.0.0.1:3000;
proxy_redirect off;
}
SSR이라 redirect off로 하고 #try_files $uri $uri/ =404;을 삭제시켜 계속해서 http://127.0.0.1:3000에 요청을 보내게 하였다.
npm install pm2 -g
pm2 start npm --name "next-app" -- run start
서버 이름을 next-app으로 실행했다.