我在 Nginx 上运行的 PHP 应用程序 (Baikal) 遇到问题。应用程序对其配置文件之一没有(不再)写入权限。该问题可能是在升级 PHP 后出现的。
以下是有关我的设置的一些信息:
- 操作系统:Arch Linux
- Nginx 版本:1.16.1
- Nginx 用户:http
- PHP版本:7.4.1
- 应用:贝加尔湖0.4.6
- Nginx 配置:
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name –––––––––;
root /usr/share/webapps/baikal/html;
index index.php;
include include/ssl.conf;
include include/letsencrypt.conf;
rewrite ^/.well-known/caldav /dav.php redirect;
rewrite ^/.well-known/carddav /dav.php redirect;
charset utf-8;
location ~ /(\.ht|Core|Specific) {
deny all;
return 404;
}
location ~ ^(.+\.php)(.*)$ {
try_files $fastcgi_script_name =404;
include /etc/nginx/fastcgi_params;
fastcgi_split_path_info ^(.+\.php)(.*)$;
fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
}
}
应用程序报告该文件具体/config.php不可写。完整路径是/usr/share/webapps/baikal/Specific/config.php.
为了测试目的,我已将文件的权限设置为777;没有成功。我测试了PHP函数is_writable
。它返回false
对于该文件。fopen
表示文件系统是只读的(实际上不是)。
我读过很多关于 SELinux 防止写操作的内容,但正如我所说,我使用 Arch Linux,它不是 SELinux。
我认为这与PHP不允许在Nginx设置的根目录之外写入有关,但我无法修复它。
有人可以帮忙吗?
多谢
好吧,搞定了。座位。
从 PHP 7.4 开始,PHP-FPM 通过安装来保护系统/usr
, /boot
, and /etc
目录只读。
This post https://serverfault.com/questions/996397/failed-to-open-stream-read-only-file-system-when-trying-to-create-file-outsid/997496和这个issue https://github.com/getgrav/grav/issues/2756让我找到了将应用程序文件夹移到外部的解决方案/usr
.
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)