Stderr로 전송된 FastCGI: 기본 스크립트를 열 수 없습니다.

Stderr로 전송된 FastCGI: 기본 스크립트를 열 수 없습니다.

상황:

서버 A와 서버 B는 동일한 Ubuntu 14.04, 동일한 nginx 버전(1.4.6), 동일한 가상 호스트(domain.com) 및 joomla 폴더(서버 A에서 B로 rsync됨)를 설치했습니다.

그러나 서버 A는 첫 페이지만 표시할 수 있으며 모든 메뉴 항목에 "지정된 파일 입력 없음"을 표시합니다.

서버 B 테스트 후 서버 A의 IP가 domain.com을 사용하도록 /etc/hosts를 변경하면 즉시 실패하지 않습니다. 몇 분 후에야 해당 오류가 나타납니다.

nginx의 오류 로그에는 아래와 같은 몇 가지 메시지가 있습니다.

2015/02/23 12:01:57 [error] 15515#0: *260609 FastCGI sent in stderr: "PHP message: PHP Notice:  Undefined property: JPagination::$pagesTotal in /var/www/joomla/templates/ashton/html/com_content/featured/default.php on line 76" while reading response header from upstream, client: 10.224.202.152, server: www.domain.com, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "www.domain.com" 

답변1

"fastcgi_param SCRIPT_FILENAME"을 추가하여 해결했습니다.

아래와 같은 예

server {
    listen 80;
    root /var/www/joomla;
    index index.php index.html index.htm;
    server_name www.domain.com;

    location / {
        try_files $uri $uri/ /index.php?q=$request_uri;
    }

    location ~ \.php$ {
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass unix:/var/run/php5-fpm.sock;
        fastcgi_index index.php;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    }
}

관련 정보