作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
在让我列出我尝试过的内容之前:
2016/08/23 09:13:40 [error] 39170#0: *13 FastCGI sent in stderr: "Access to the script
'/Users/user/portal3' has been denied (see security.limit_extensions)" while reading
response header from upstream, client: 127.0.0.1, server: localhost, request:
"GET /portal/v3/index.php HTTP/1.1", upstream: "fastcgi://127.0.0.1:9001", host: "localhost"
[23-Aug-2016 09:13:40] WARNING: [pool dev] child 8305 said into stderr: "NOTICE: Access to the script '/Users/user/portal3' has been denied (see security.limit_extensions)"
[dev]
user=user
group=staff
listen=127.0.0.1:9001
listen.mode = 0666
pm = ondemand
pm.max_children = 10
pm.process_idle_timeout = 10s
pm.status_path = /status_user
catch_workers_output = yes
security.limit_extensions = .php
server {
listen 80;
server_name localhost;
###root /var/www/;
access_log /usr/local/etc/nginx/logs/default.access.log main;
access_log /usr/local/etc/nginx/logs/default.scripts.log scripts;
location /portal/v3 {
alias /Users/user/portal3;
location ~ ^/portal/v3/(.+\.php)(/.*)$ {
#alias /Users/user/portal3;
index index.php;
# Mitigate https://httpoxy.org/ vulnerabilities
fastcgi_param HTTP_PROXY "";
fastcgi_pass 127.0.0.1:9001;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$2;#$fastcgi_script_name;
include fastcgi_params;
}
}
location = /info {
allow 127.0.0.1;
deny all;
rewrite (.*) /.info.php;
}
location / {
root /var/www/;
index index.php index.html index.htm;
include /usr/local/etc/nginx/conf.d/php-fpm;
}
error_page 404 /404.html;
error_page 403 /403.html;
}
最佳答案
在您的 PHP-FPM config你有一个指令叫 security.limit_extensions
Limits the extensions of the main script FPM will allow to parse. This can prevent configuration mistakes on the web server side. You should only limit FPM to .php extensions to prevent malicious users to use other extensions to execute php code. Default value: .php.
location
块不包含
index
指令,nginx 不知道使用
index.php
作为路径指向
/Users/user/portal3
时的默认索引文件.相反,它尝试将其作为 PHP 脚本执行,而 PHP-FPM 提出了
/Users/user/portal3
的安全限制。没有 .php 扩展名。
location /portal/v3 {
alias /Users/user/portal3;
index index.php;
location ~ ^/portal/v3/(.+\.php)(/.*)$ {
fastcgi_param HTTP_PROXY "";
fastcgi_pass 127.0.0.1:9001;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$2;#$fastcgi_script_name;
include fastcgi_params;
}
}
关于php - 对脚本 '/path/to/script.php' 的访问已被拒绝(请参阅 security.limit_extensions),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39104150/
在让我列出我尝试过的内容之前: This Answer on ServerFault chmoded/Users/user/portal3 到 777 看看是否执行 创建了两个池,一个是 root,另
我正在尝试使用 Nginx 和 php-fpm 配置我的网络服务器 我之前在我的本地计算机和开发服务器上已经成功配置,但现在在 AWS 中没有。 唯一的区别是我从生产服务器中的源代码安装了 Nginx
我是一名优秀的程序员,十分优秀!