Nginx访问PHP文件提示File not found / 403 Forbidden

释放双眼,带上耳机,听听看~!

我在mac中搭建nginx + wordpress 访问,不想使用apache

在搭建的过程中访问一直提示File not found,不管是我自建的php文件还是wordpress程序,都是如此,要么就是403 Forbidden

解决方法:

找到Nginx的conf配置文件 /usr/local/etc/nginx

详细的nginx文章介绍可查看

[tangrui_insert_post ids=461]

其一:找到你的server开放

location ~ \.php$ {
    root html;
    fastcgi_pass 127.0.0.1:9000;
    fastcgi_index index.php;
    fastcgi_param SCRIPT_FILENAME/scripts$fastcgi_script_name; 
    include fastcgi_params;
}

并且将以下的

fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;

替换成

fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

其二:修改用户组

找到你的php-fpm的配置文件,找到下面这段,把apache替换成你要的用户组

; RPM: apache Choosed to be able to access some dir as httpd
user = apache
; RPM: Keep a group allowed to write in log dir.
group = apache

人已赞赏
0 条回复 A文章作者 M管理员
    暂无讨论,说说你的看法吧