分类
PHP

Mac安装Nginx和PHP7.1

Mac安装Nginx和PHP7.1

折腾了很久,到处找资料,我是用homebrew安装的,遇到了两种错误情况,第一是打开php文件直接下载,第二是打开php文件显示404

说一下重点吧:

第一,这里不要打开:

proxy the PHP scripts to Apache listening on 127.0.0.1:80

    #
    #location ~ \.php$ {
    #    proxy_pass   http://127.0.0.1;
    #

第二,这里的SCRIPT_FILENAME改成$document_root,或者改成路径:

pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000

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

发表评论

邮箱地址不会被公开。 必填项已用*标注