사용자 도구

사이트 도구


webapp:nginx:php_연동

차이

문서의 선택한 두 판 사이의 차이를 보여줍니다.

차이 보기로 링크

양쪽 이전 판이전 판
다음 판
이전 판
webapp:nginx:php_연동 [2020/02/09 14:25] kieunswebapp:nginx:php_연동 [2024/04/23 22:44] (현재) – 바깥 편집 127.0.0.1
줄 1: 줄 1:
  
 +{{htmlmetatags>metatag-robots=() 
 +metatag-keywords=(nginx,php,연동,nginx php 연동,디렉토리) 
 +metatag-description=(nginx php 연동)
 +metatag-description=(no input file specified. nginx php)
 +}}
 +
 +관련 링크
 +
 +| [[os:osx:웹서버-설정|OSX 웹서버 설정]] |
 +
 +====== Windows nginx와 php 연동 ======
 +
 +  * php cgi를 띄우고
 +  * nginx에는 php가 들어오면 이쪽으로 되돌려주도록 설정해서 씁니다.
 +
 +php측
 +
 +^ PHP 설치 폴더                                     ^
 +| <code> php-cgi.exe -b 127.0.0.1:9123 </code>  |
 +| 포트는 (9123) 임의 설정                              |
 +
 +
 +nginx 측
 +
 +^ nginx 설치폴더/conf/nginx.conf ^
 +| <code>
 +http {
 +    
 +    #
 +    # .. 원래 있던 여러 항목들 ..
 +    #
 +    
 +    server {
 +        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
 +        #
 +        location ~ \.php$ {
 +            fastcgi_pass   127.0.0.1:9123;
 +            fastcgi_index  index.php;
 +            
 +            # SCRIPT_FILENAME 이 잘못되어 있으면 오류남
 +            fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
 +            
 +            include        fastcgi_params;
 +        }
 +     
 +        #   
 +        # .. 그외 원래 있던 것들 ..
 +    }
 +}
 +</code>|
 +
 +===== no input file specified =====
 +
 +  no input file specified.
 +
 +위의 에러가 뜰때는, 
 +
 +  fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
 +
 +파일을 못찾아서 나는 에러니,
 +
 +fastcgi_param 부분에서 **$document_root** 로 시작하는지 확인합니다.
 +
 +{{tag>php nginx 연동}}
 +
 +====== 디렉토리 리스팅 켜기 ======
 +
 +**nginx.conf** 파일을 수정한다.
 +
 +수정할 부분은 **http {** ... **server {**  .. 안쪽에 
 +
 +  autoindex on;
 +
 +추가한다.
 +
 +^ 예시 ^
 +| <code>
 +http {
 +    server {
 +        #   
 +        # .. 그외 원래 있던 것들 ..
 +        #
 + autoindex on;
 +    }
 +}
 +</code>|
 +
 +{{tag>nginx 디렉토리 디렉토리_리스팅}}