海外sns网站,网络软文营销的案例,网站建设策划方案书,济南哪家公司做网站linux系统上使用nginx访问php文件返回File not found错误处理方案 第一种情况第二种情况 第一种情况
可以在你的location php 里面添加当文件不存在时返回404而不是交给php-fpm进行处理
location ~ \.php$
{
...
#文件不存在转404
try_files $uri 404;
...
}然后#xff0c… linux系统上使用nginx访问php文件返回File not found错误处理方案 第一种情况第二种情况 第一种情况
可以在你的location php 里面添加当文件不存在时返回404而不是交给php-fpm进行处理
location ~ \.php$
{
...
#文件不存在转404
try_files $uri 404;
...
}然后在你的配置文件中找到下面这段
fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
替换成下面fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;然后重新加载nginx配置文件 systemctl restart nginx
第二种情况
两种解决方法 第一种就是把你root文件夹设为其他用户允许 第二种找到你的php-fpm的配置文件找到下面这段把apache替换成你要的用户组
; RPM: apache Choosed to be able to access some dir as httpd
user nginx
; RPM: Keep a group allowed to write in log dir.
group nginx