2017-11-01 2 views
1
의 위치 경기에 관계없이 하나의 파일을 제공

나의 현재 구성이nginx를

/ 일치

server{ 
    listen 80; 
    server_name some.com; 

    location /{ 
     root /var/www; 
     index index.html; 
    } 
} 

입니다 위치가 루트에 추가되지 않아야합니다. 그래서 매칭이 될 것입니다

/ ->/var/www/index.html

/container ->/var/www/index.html

그것은 상관없이 위치 동일합니다, 나는이 동적으로 렌더링 처리 할 수 ​​있습니다.

답변

2

일반적인 방법은 기본 URI를 제공하기 위해 try_files을 사용하는 것입니다

server{ 
    listen 80; 
    server_name some.com; 

    root /var/www; 
    index index.html; 

    location/{ 
     try_files $uri $uri/ /index.html; 
    } 
} 

자세한 것은 this document를 참조하십시오.