Suexec없이 올바르게 작동하는 Apache2.4 + FastCgi, PHP-FPM, SuExec을 설정했습니다. 하지만 Suexec을 사용하면 File does not exist 오류 (404는 PHP 스크립트에 액세스 할 때 브라우저에서 오류 찾을 수 없음) 오류가 발생하지 않습니다.Apache FastCgi, PHP-FPM, Suexec 권한 거부 오류
참고 : 나는 그 나에게 404 오류를주는 켤 때 내가 OFF "FastCgiWrapper"을 설정하지만, 때 PHP 스크립트 PHP-FPM을 통해 작동합니다.
아파치 오류 로그 (마지막 줄) :
[authz_core:debug] [pid 3906:tid 140546979436288] mod_authz_core.c(802): [client 192.168.91.132:58225] AH01626: authorization result of Require all granted: granted
[authz_core:debug] [pid 3906:tid 140546979436288] mod_authz_core.c(802): [client 192.168.91.132:58225] AH01626: authorization result of <RequireAny>: granted
[authz_core:debug] [pid 3906:tid 140546979436288] mod_authz_core.c(802): [client 192.168.91.132:58225] AH01626: authorization result of Require all granted: granted
[authz_core:debug] [pid 3906:tid 140546979436288] mod_authz_core.c(802): [client 192.168.91.132:58225] AH01626: authorization result of <RequireAny>: granted
[core:info] [pid 3906:tid 140546979436288] [client 192.168.91.132:58225] AH00128: File does not exist: /etc/apache2/fcgi-app/info.php
구성 :
/etc/apache2/mods-available/fastcgi.conf
FastCgiWrapper On
/등/아파치/suexec/www-data
/var/www/html
/cgi-bin
/etc/apache2/sites-available/example.net.conf
<VirtualHost *:80>
ServerName example.net
ServerAdmin [email protected]
DocumentRoot /var/www/html/example.net/public_html
LogLevel debug
ErrorLog ${APACHE_LOG_DIR}/error.log
SuexecUserGroup example examplegrp
AddHandler php-fcgi-hand .php
Action php-fcgi-hand /php-fcgi-uri
Alias /php-fcgi-uri fcgi-app
FastCgiExternalServer fcgi-app -socket /var/run/php5-fpm-example.sock -pass-header Authorization -idle-timeout 30000 -flush
<Location /php-fcgi-uri>
Require all granted
</Location>
</VirtualHost>
/etc/php5/fpm/pool.d/example.conf
[example]
user = example
group = examplegrp
listen = /var/run/php5-fpm-example.sock
listen.owner = example
listen.group = examplegrp
listen.mode = 0666
pm = dynamic
pm.max_children = 5
pm.start_servers = 2
pm.min_spare_servers = 1
pm.max_spare_servers = 3
의/var/www /에서 HTML/example.net이 방법으로/cgi-bin/php.cgi
#!/bin/sh
PHP_FCGI_CHILDREN=5
export PHP_FCGI_CHILDREN
PHP_FCGI_MAX_REQUESTS=500
export PHP_FCGI_MAX_REQUESTS
exec /var/www/html/example.net/cgi-bin
폴더 구조와 권한
/var/www/html/example.net/cgi-bin/php.cgi
/var/www/html/example.net/public_html/info.php
drwxrwxrwx 13 www-data www-data var
|____drwxr-xr-x 5 www-data www-data www
|____drwxr-xr-x 6 www-data www-data html
|____ drwxr-xr-x 4 example examplegrp example.net
|______ drwxr-xr-x 2 example examplegrp cgi-bin
|_____-r-xr-xr-x 1 example examplegrp php.cgi
|______ drwxr-xr-x 2 example examplegrp public_html
|_____-rwxr-xr-x 1 example examplegrp info.php
내가 장님이 아니라면, 여기 PHP-FPM을 사용하고 있다는 것을 보여주는 내용이 없습니다. PHP-CGI를 사용하고있는 것으로 보입니다. FPM은 소켓 또는 tcp로 연결된 풀을 사용합니다. 어떤 예에서도이 사용법을 보여주지 못합니다. – Diemuzi
@Diemuzi PHP-FPM을 사용하도록 vhost를 구성했으나 정상적으로 작동하지만 "FastCgiWrapper"를 켜면 "404 Not Found"오류가 발생합니다. 업데이트 된 질문을 확인하십시오. – sravis