사용자 도구

사이트 도구


사이드바

카테고리

webapp:nginx:php_연동

관련 링크

Windows nginx와 php 연동

  • php cgi를 띄우고
  • nginx에는 php가 들어오면 이쪽으로 되돌려주도록 설정해서 씁니다.

php측

PHP 설치 폴더
 php-cgi.exe -b 127.0.0.1:9123 
포트는 (9123) 임의 설정

nginx 측

nginx 설치폴더/conf/nginx.conf
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;
        }
     
        #   
        # .. 그외 원래 있던 것들 ..
    }
}

no input file specified

no input file specified.

위의 에러가 뜰때는,

fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;

파일을 못찾아서 나는 에러니,

fastcgi_param 부분에서 $document_root 로 시작하는지 확인합니다.

디렉토리 리스팅 켜기

nginx.conf 파일을 수정한다.

수정할 부분은 http {server { .. 안쪽에

autoindex on;

추가한다.

예시
http {
    server {
        #   
        # .. 그외 원래 있던 것들 ..
        #
	autoindex on;
    }
}
webapp/nginx/php_연동.txt · 마지막으로 수정됨: 2020/03/08 18:15 저자 kieuns