CENTOS 7의 PHP 5.4, NGINX, 페이지를 찾을 수 없음 오류

CENTOS 7의 PHP 5.4, NGINX, 페이지를 찾을 수 없음 오류

CentOS 7에 PHP 5.4를 설치하려고 합니다.

현재 내 conf 파일은 다음과 같습니다.

/etc/nginx/conf.d

server {
 listen       80;
 server_name  178.62.255.79;

 root   /usr/share/nginx/html;
 index index.php index.html index.htm;

 location / {
     try_files $uri $uri/ =404;
 }
 error_page 404 /404.html;
 error_page 500 502 503 504 /50x.html;
 location = /50x.html {
     root /usr/share/nginx/html;
 }

 location ~ \.php$ {
     try_files $uri =404;
     fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
     fastcgi_index index.php;
     fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
     include fastcgi_params;
 } }

/etc/php-fpm.d/www.conf가 기본값입니다.

listen = /var/run/php-fpm/php-fpm.sock

한 가지 주목할 점은 /var/run/php-fpm/ 디렉토리를 보면 php-fpm.socks라는 파일이 있다는 것입니다.

서버는 http 요청을 실행할 수 있지만(nginx는 작동 중), 제공되는 PHP 파일을 탐색하려고 하면,

찾고 계신 페이지를 일시적으로 이용할 수 없습니다. 나중에 다시 시도 해주십시오.

나는 많은 지침을 따랐고 그들은 모두 127.0.0.1:9000을 php-fpm.sock로 변경해야 한다고 말했지만 그것도 작동하지 않았습니다.

두 conf 파일을 모두 127.0.0.1:9000으로 설정하면 작동하지 않습니다. FastCGI 프로세스 관리자가 데이터를 수신하지 못하는 것 같습니다.

사용 가능한 솔루션을 알고 계십니까?

감사해요

답변1

/etc/php-fpm.d/www.conf 파일을 확인하고 사용자 및 그룹을 apache에서 nginx로 변경했는지 확인하세요.

user = nginx
group = nginx

그렇다면 systemctl restart php-fpm.service도움이 되는지 확인해 보세요!

관련 정보