Server/Nginx (engine x)

[Nginx] url 직접 접근 시 not-found현상/ index파일을 찾지 못할 경우

annajinee 2017. 7. 10. 18:39


빌드한 파일 경로와 index파일 위치를 명시했는데도 url로 직접 접근 시 not-found 현상이 생기는 경우가 있습니다. 

저의 경우에는 Nginx셋팅 파일 내에 try처리를 하여 해결하였습니다. 

default.conf 파일의 location에다가 try_files 처리를 추가합니다.

( 파일 위치 아래 글 참고 )


그 부분만 따로 보면 아래와 같이 추가하였습니다. 


    location / {

        #root   /usr/share/nginx/html;

        root    /home/test/dist;

        index  index.html index.htm;

        try_files $uri $uri/ /index.html;

        proxy_connect_timeout 300;

        proxy_send_timeout 300;

        proxy_read_timeout 300;

        send_timeout 3000;

    }