Ste*_*ein 2 php-fpm apache-2.4 mod-proxy-fcgi
我已经根据本教程( https://wiki.apache.org/httpd/PHP-FPM )或多或少配置了一个网络服务器,但我无法让 PHP 工作。HTML 文件可以正常使用。我收到以下错误消息:
mod_authz_core.c(802): [client <myip>:36570] AH01626: authorization result of Require all denied: denied
mod_authz_core.c(802): [client <myip>:36570] AH01626: authorization result of <RequireAny>: denied
127.0.0.1 [client <myip>:36570] AH01630: client denied by server configuration: proxy:fcgi://127.0.0.1:9000/var/www/html/test.php
Run Code Online (Sandbox Code Playgroud)
这是我的 PHP 文件:
www@<server>:/var/www/html$ ls -l
-rw-rw---- 1 www www-data 26 Sep 6 09:14 test.php
Run Code Online (Sandbox Code Playgroud)
如您所见,该文件属于“www”。网络服务器和“php-fpm”作为“www-data”运行。
这是“apache.conf”的基本配置:
<Directory />
Options FollowSymLinks
AllowOverride None
Require all denied
</Directory>
<Directory /usr/share>
AllowOverride None
Require all granted
</Directory>
<Directory /var/www/html>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
Run Code Online (Sandbox Code Playgroud)
这是我的虚拟主机的配置:
<VirtualHost *:80>
ServerAdmin admin@example.com
DocumentRoot /var/www/html
<Directory "/var/www/html">
Options FollowSymLinks
AllowOverride None
Require all granted
</Directory>
ErrorLog /var/log/apache2/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel debug
CustomLog /var/log/apache2/access.log combined
ServerSignature Off
# Enable forwarding of php requests via php-fpm
ProxyPassMatch ^/(.*\.php(/.*)?)$ fcgi://127.0.0.1:9000/var/www/html/$1
</VirtualHost>
Run Code Online (Sandbox Code Playgroud)
我的印象是“要求所有已授予”部分将阻止访问 php 文件,并且 mod_authz 会对此感到满意。
我已经检查过“php-fpm”是否正在按原样监听:
www@<server>:/etc/php5/fpm/pool.d$ netstat -an | grep :9000
tcp 0 0 127.0.0.1:9000 0.0.0.0:* LISTEN
Run Code Online (Sandbox Code Playgroud)
现在我不知道下一步该去哪里。有什么建议么?
根据要求,这是带有一些额外解释的答案。
错误“客户端被服务器配置拒绝”有一些非常具体的原因,所有这些原因都在此处详细说明http://wiki.apache.org/httpd/ClientDeniedByServerConfiguration
正如我在评论中提到的, <Directory> 块不会影响任何被代理的请求,因为它们只影响 Apache 本身映射到文件系统路径的请求。
查找任何允许/拒绝访问基本 URI 路径或 .php 文件的位置或文件块。
我提出的似乎有效的解决方案是将以下块添加到虚拟主机。
<地点/> 要求全部授予 </地点>
我仍然建议在配置的其余部分中查找其他位置/文件块,因为应该有其他原因导致请求最初被拒绝。添加此块允许请求开始工作,因为 Apache 合并这些类型的块的方式,如以下链接所述。
https://httpd.apache.org/docs/current/sections.html
归档时间: |
|
查看次数: |
25240 次 |
最近记录: |