ETC/MacOS,Rancher
Rancher - react build html nginx로 띄워보기
건담아빠
2024. 3. 15. 14:44
react로 개발되고 빌드된 html를 로컬에서 nginx로 띄워볼 일이 생겼다, 간단하지만 정리는 해두자.
custom.conf 생성
$ vi /Users/deokjoonkang/dev/opt/nginx/config/custom.conf
server {
listen 80;
server_name example.com;
root /usr/share/nginx/html;
index index.html;
location / {
try_files $uri $uri/ /index.html;
}
}
컨테이너 실행
$ nerdctl run -d -p 8090:80 \
-v /Users/deokjoonkang/dev/opt/nginx/config/custom.conf:/etc/nginx/conf.d/custom.conf:ro \
-v /Users/deokjoonkang/dev/projects/neoflat/uceo/source/build:/usr/share/nginx/html:ro \
nginx:alpine