$ cd /usr/share/nginx $ sudo git clone https://github.com/JSCODE-COURSE/nginx-frontend-next.git
$ cd nginx-frontend-next $ sudo npm i $ sudo npn run build
/** @type {import('next').NextConfig} */ const nextConfig = { output: 'export' }; export default nextConfig;
$ cd /etc/nginx/conf.d $ sudo vi default.conf
/etc/nginx/conf.d/default.confserver { listen 80; server_name localhost; location / { root /usr/share/nginx/nginx-frontend-next/out; index index.html; } error_page 500 502 503 504 /50x.html; location = /50x.html { root /usr/share/nginx/html; } }
# Nginx 설정 파일 중 문법 에러가 있는 지 체크 $ sudo nginx -t # Nginx의 설정 파일이 바뀐 경우 아래 명령어를 입력해줘야 설정 파일이 반영된다. $ sudo nginx -s reload
http://{EC2 IP 주소} 주소로 접속해보자. 