질문 Q #23138
ci4 설정
Leader군 2021-03-25 16:34:29

전에 계속 ci3을 이용하다가 

이번에 ci4를 설치하였습니다. 

현재 www.example.com/public/index.php , www.example.com/public/ 모두 잘 출력 됩니다. 

CI가이드 문서대로 Controllers에 Pages.php를 만들고 

 www.example.com/public/index.php/pages ,  www.example.com/public/pages

 www.example.com/public/index.php/Home,  www.example.com/public/home

모두 404 에러가 출력 됩니다. 

nginx 문제 인것 같은데 어떻게 설정하면 될가요 ?

 

server{ 

      listen 80;     

  server_name www.test.com;   

    root /home/test/www/public;   

    index index.php     

  autoindex on;

        location ~ \.php$ {   

            fastcgi_pass 127.0.0.1:9000;       

        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;   

            include fastcgi_params;   

    }

}

 

nginx 로그상 ??? is not found (20: Not a directory), 출력됩니다.

답변 8
#1 테러보이 2021-03-25 16:36:30

http://ci4doc.cikorea.net/general/environments.html?highlight=nginx

설정확인해보세요.

 

 www.example.com/index.php/pages 또는  www.example.com/pages 가 되야합니다.

#2 변종원(웅파) 2021-03-25 16:36:37
public 디렉토리를 웹서버의 루트로 설정해야 합니다. 그리고 www.ex.com 으로 접속하는 겁니다.
#3 Leader군 2021-03-25 16:47:53

@테러보이

위 설명대로 했는데도 안됩니다.

#4 테러보이 2021-03-25 18:18:34

 www.example.com/index.php/pages 또는  www.example.com/pages 이렇게 접속하셨나요?

nginx 설정하고 리스타트도 하셨고?

#5 Leader군 2021-03-25 23:04:47

www.example.com/index.php/pages 또는  www.example.com/pages 로 접속했는데도 404 에러가 출력 됩니다.

ngnix 설정하고 당얀히 리사트타 했구요

#6 테러보이 2021-03-26 10:08:23
제가 주로 사용하는 nginx설정입니다. 참고하세요 https://cikorea.net/bbs/view/tip?idx=22071
#7 Leader군 2021-03-26 10:20:50

해결 했습니다. 

PHP.ini 에서 cgi.fix_pathinfo=1 를 켜져야 되드라구요.

#8 Leader군 2021-03-26 10:22:30

추가로 더 문의 할게 있는데.

nginx 에 어떻게 설정하면 먼저 ci 결로를 방문하고 해당 파일이 없으면 root 쪽을 방문하게 하죠?