[Nginx] redirection error

2022. 4. 13. 16:51Nginx

아래와 같은 에러를 뱉고 있다면,

2022/03/09 07:47:47 [error] 1361#1361: *518 rewrite or internal redirection cycle while internally redirecting to "/index.php", 
client: 125.143.140.7, server: ec2-3-39-30-218.ap-northeast-2.compute.amazonaws.com, request: "GET /myPage 
HTTP/1.1", host: "ec2-3-39-30-218.ap-northeast-2.compute.amazonaws.com"

nginx 설정 중 location 부분을

location / {
    try_files $uri $uri/ /index.php?$query_string;
}

아래와 같이 변경

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

redirect가 일어날 때 index.php참조. 파일이 없으므로 500 에러 발생함

react는 root 페이지인 index.html?$query_string; 로 설정해야 함

'Nginx' 카테고리의 다른 글

[Nginx] 웹, 모바일 location 분리  (0) 2022.12.15
[Nginx] Proxy 설정  (0) 2022.11.10
[Nginx] Nginx + PHP 파일 사이즈 설정  (0) 2022.04.13