我做了一個Apache2.4 + FastCgi,PHP-FPM,SuExec的設置,它可以在沒有Suexec的情況下正常工作。但是,當我啓用Suexec它給我文件不存在錯誤(當我訪問PHP腳本時,瀏覽器中404未找到錯誤)。Apache FastCgi,PHP-FPM,Suexec權限被拒絕錯誤
注: PHP腳本通過PHP-FPM當我打開OFF 「FastCgiWrapper」,但是當我打開它給我404錯誤。
Apache的錯誤日誌(最後行):
[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
的/ etc /的Apache2/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
/無功/網絡/ 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 2014-09-19 19:43:17
@Diemuzi我已經配置了vhost來使用PHP-FPM,它工作正常,但是當我打開「FastCgiWrapper」時,它給了我錯誤「404 Not Found」。請檢查我更新的問題。 – sravis 2014-09-20 03:39:41