ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • 카카오톡 플러스친구 스마트채팅 API 개발하기 - 2. 환경 설정하기
    프로그래밍/자연어처리 2018. 3. 27. 13:16
    반응형






    카카오톡 플러스친구 스마팅채팅 API 개발하기 


    1. 시작하기 

    2. 환경 설정하기 





    keyboard.php를 작성하였는데 아래와 같은 에러가 발생하였다. 


    에러 수정하면서 나온 삽질들을 기록해보겠다. 



    웹페이지에서 base url/keyboard를 하니 

    페이지를 찾을 수 없다는 에러 메세지가 나온다. 

    검색해보니 Multiviews 옵션 설정이 되어 있지 않아서 라고 한다. 


    Multiviews 옵션을 주면 파일 확장자를 입력하지 않아도 

    아파치의 mod_negotiation의 모듈에 의해 자동으로 가장 잘 맞는 파일을 선택할 수 있다. 


    Multiviews 옵션을 줄 수 있는 방법은 여러가지가 있다. 


    일단 .htaccess 파일에서 아래 라인을 추가해보았다. 


    참고로 아파치2 설정들


     에러 로그 파일 위치: /var/log/apache2/error.log

    config 파일 위치 : /etc/apache2/apache2.conf

    재시작: /etc/init.d/apache2 restart 



    Options +Multiviews





    그랬더니 무시무시한 Internal Server Error가 ㅠㅠ 



    Internal Server Error
    The server encountered an internal error or misconfiguration and was unable to complete your request.

    Please contact the server administrator to inform them of the time this error occurred, and the actions you performed just before this error.

    More information about this error may be available in the server error log.


    급하기 아파치 로그 파일을 확인해니 
    Options not allowed here 에러 메세지가 있다. 
    검색해보니 보안 문제로 .htaccess에서 해당 옵션을 수정할 수 없다고 한다.




    [Tue Sep 05 01:41:28.009590 2017] [core:alert] [pid 18112] /public_html/.htaccess: Options not allowed here

    [Tue Sep 05 01:41:28.157225 2017] [core:alert] [pid 19510] [client **7] .htaccess Options not allowed here, referer: http:/***.co.kr/keyboard

    [Tue Sep 05 01:41:43.792095 2017] [core:alert] [pid 27550] [client **] .htaccess: Options not allowed here

    [Tue Sep 05 01:41:43.870598 2017] [core:alert] [pid 18334] [client **] .htaccess: Options not allowed here, referer: http://***.co.kr/keyboard




    참고 블로그 1


    https://kx.cloudingenium.com/linux/apache-web-server/solve-apache-error-htaccess-option-multiviews-allowed/



     아파치 기본 설정 파일(/etc/apache2/apache2.conf)에서 
    해당 옵션을 추가하고 아파치를 재시작 하였다. 

    재시작: /etc/init.d/apache2 restart 






    <Directory /var/www/>
            Options Indexes MultiViews
            AllowOverride None
            Require all granted
    </Directory>





    이제 500 에러는 사라졌는데 
    여전히 keyboard를 치면 keyboard.php가 로딩되지 않는다. 
    다시 에러 로그를 확인해보니 negotiate 실패하였다는 메세지가 나온다. 





     vi /var/log/apache2/error.log

    [Wed Sep 06 01:35:38.725690 2017] [negotiation:error] [pid 17689] [client 110.76.143.234:44834] AH00687: Negotiation: discovered file(s) matching request: /home/land/public_html/keyboard (None could be negotiate



    다시 구글링해보니 mine.conf에서 php 옵션 설정을 해야 한다고 한다. 

    mod_negotiation 모듈은 이미 mine.conf에서 

    정해진 파일 타입만 찾는다고 한다. 


    ( mod_negotiation only looks for "interesting" (and known) file types. ) 


    마지막으로 해당 옵션을 추가 하니 드디어 문제없이 작동한다 ㅠㅠ


     


    vi /etc/apache2/mods-available/mime.conf




     AddType application/x-compress .Z
     AddType application/x-gzip .gz .tgz
    AddType application/x-bzip2 .bz2
    AddType application/x-httpd-php .php


    드디어 정상적으로 API 테스트가 완료되고 스마트 채팅 개발이 시작되었다.





    그리고 앞으로 이 github에 개발 내용을 공유할 예정이니 

    관심있는 분은 방문이나 watch 걸어주셈!






    728x90
    반응형
Designed by Tistory.