mac nginx+php-fpm配置(安装过后nginx后访问php文件下载,访问php文件请求200显示空白页面)

访问php文件下载是因为没配置php-fpm

两个问题主要都是nginx.conf配置的问题:

/usr/local/etc/nginx/nginx.conf

server {
    listen 80;
    server_name localhost;
    root /usr/local/var/www;

    #charset koi8-r;

    #access_log logs/host.access.log main;

    location / {
        root /usr/local/var/www;
        index index.php index.html index.htm;
    }

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

对应上面添加配置信息,我的项目放在默认的www目录下

原文地址:https://www.cnblogs.com/chaihy/p/9051805.html